diff options
author | zeripath <art27@cantab.net> | 2022-12-01 23:56:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 07:56:51 +0800 |
commit | 64973cf18fcd21179fb7612b15914691ee24c657 (patch) | |
tree | 0aaaeca2ad7a880bbe0d5144ecc7f3cf05f0973e /modules | |
parent | f0bd219a5e153ddcf6806334da700aac46fcefad (diff) | |
download | gitea-64973cf18fcd21179fb7612b15914691ee24c657.tar.gz gitea-64973cf18fcd21179fb7612b15914691ee24c657.zip |
Use path not filepath in template filenames (#21993)
Paths in git are always separated by `/` not `\` - therefore we should
`path` and not `filepath`
Fix #21987
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/issue/template/unmarshal.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/issue/template/unmarshal.go b/modules/issue/template/unmarshal.go index f43a83fb62..8cae8d4c42 100644 --- a/modules/issue/template/unmarshal.go +++ b/modules/issue/template/unmarshal.go @@ -6,7 +6,7 @@ package template import ( "fmt" "io" - "path/filepath" + "path" "strconv" "code.gitea.io/gitea/modules/git" @@ -43,7 +43,7 @@ func Unmarshal(filename string, content []byte) (*api.IssueTemplate, error) { // UnmarshalFromEntry parses out a valid template from the blob in entry func UnmarshalFromEntry(entry *git.TreeEntry, dir string) (*api.IssueTemplate, error) { - return unmarshalFromEntry(entry, filepath.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 @@ -108,7 +108,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.Content = string(content) - it.Name = filepath.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) } else { it.Content = templateBody |