@ -7,7 +7,7 @@ package template
import (
import (
"fmt"
"fmt"
"io"
"io"
"path/filepath "
"path"
"strconv"
"strconv"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/git"
@ -44,7 +44,7 @@ func Unmarshal(filename string, content []byte) (*api.IssueTemplate, error) {
// UnmarshalFromEntry parses out a valid template from the blob in entry
// UnmarshalFromEntry parses out a valid template from the blob in entry
func UnmarshalFromEntry ( entry * git . TreeEntry , dir string ) ( * api . IssueTemplate , error ) {
func UnmarshalFromEntry ( entry * git . TreeEntry , dir string ) ( * api . IssueTemplate , error ) {
return unmarshalFromEntry ( entry , file path. Join ( dir , entry . Name ( ) ) )
return unmarshalFromEntry ( entry , path . Join ( dir , entry . Name ( ) ) ) // Filepaths in Git are ALWAYS '/' separated do not use filepath here
}
}
// UnmarshalFromCommit parses out a valid template from the commit
// UnmarshalFromCommit parses out a valid template from the commit
@ -109,7 +109,7 @@ func unmarshal(filename string, content []byte) (*api.IssueTemplate, error) {
// It could be a valid markdown with two horizontal lines, or an invalid markdown with wrong metadata.
// It could be a valid markdown with two horizontal lines, or an invalid markdown with wrong metadata.
it . Content = string ( content )
it . Content = string ( content )
it . Name = file path. Base ( it . FileName )
it . Name = path . Base ( it . FileName ) // paths in Git are always '/' separated - do not use filepath!
it . About , _ = util . SplitStringAtByteN ( it . Content , 80 )
it . About , _ = util . SplitStringAtByteN ( it . Content , 80 )
} else {
} else {
it . Content = templateBody
it . Content = templateBody