Skip to content

Commit 332b937

Browse files
committed
feat(serverHandler/upload): allow upload file without dir prefix
Previously, if upload mode is "dirfile", uploaded file path must starts with a directory prefix, e.g. "dir/to/file". To allow upload files mixed with directories, remove this restriction.
1 parent ff40288 commit 332b937

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/serverHandler/upload.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ func (h *handler) saveUploadFiles(fsPrefix string, createDir, overwriteExists bo
7373
fsInfix := ""
7474
formname := part.FormName()
7575
if formname == dirFile {
76-
if slashIndex <= 0 {
77-
continue
76+
if slashIndex > 0 {
77+
fsInfix = partFilename[0:slashIndex]
7878
}
79-
fsInfix = partFilename[0:slashIndex]
8079
} else if formname == innerDirFile { // get file path, strip first level of dir
8180
if slashIndex <= 0 {
8281
continue

0 commit comments

Comments
 (0)