Skip to content

Commit 633f52c

Browse files
authored
Fix filepath basename on Windows for SVG bindata (#12241)
1 parent 84a419d commit 633f52c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

modules/svg/discover_bindata.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package svg
88

99
import (
10-
"path"
1110
"path/filepath"
1211

1312
"code.gitea.io/gitea/modules/public"
@@ -22,7 +21,7 @@ func Discover() map[string]string {
2221
if matched {
2322
content, err := public.Asset(file)
2423
if err == nil {
25-
filename := path.Base(file)
24+
filename := filepath.Base(file)
2625
svgs[filename[:len(filename)-4]] = string(content)
2726
}
2827
}

modules/svg/discover_nobindata.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package svg
88

99
import (
1010
"io/ioutil"
11-
"path"
1211
"path/filepath"
1312

1413
"code.gitea.io/gitea/modules/setting"
@@ -18,11 +17,11 @@ import (
1817
func Discover() map[string]string {
1918
svgs := make(map[string]string)
2019

21-
files, _ := filepath.Glob(path.Join(setting.StaticRootPath, "public", "img", "svg", "*.svg"))
20+
files, _ := filepath.Glob(filepath.Join(setting.StaticRootPath, "public", "img", "svg", "*.svg"))
2221
for _, file := range files {
2322
content, err := ioutil.ReadFile(file)
2423
if err == nil {
25-
filename := path.Base(file)
24+
filename := filepath.Base(file)
2625
svgs[filename[:len(filename)-4]] = string(content)
2726
}
2827
}

0 commit comments

Comments
 (0)