Skip to content

Commit 568ce3a

Browse files
committed
fix(upload): skip prefix directory name
1 parent c614b36 commit 568ce3a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/serverHandler/upload.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"path"
1010
"strconv"
11+
"strings"
1112
)
1213

1314
func getAvailableFilename(fsPrefix, filename string, mustAppendSuffix bool) string {
@@ -54,6 +55,10 @@ func (h *handler) saveUploadFiles(fsPrefix string, overwriteExists bool, aliasSu
5455
}
5556

5657
filename := part.FileName()
58+
slashIndex := strings.LastIndexAny(filename, "/\\")
59+
if slashIndex >= 0 {
60+
filename = filename[slashIndex+1:]
61+
}
5762
if len(filename) == 0 {
5863
continue
5964
}

0 commit comments

Comments
 (0)