Skip to content

Commit c40f2bb

Browse files
committed
feat: create directory in buildDirName function if it doesn't
1 parent d2e4950 commit c40f2bb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/flydav/app/webdav.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ func buildDirName(fsDir, subFsDir string) webdav.Dir {
130130
if subFsDir == "" {
131131
return webdav.Dir(fsDir)
132132
}
133-
return webdav.Dir(filepath.Join(fsDir, subFsDir))
133+
dir := filepath.Join(fsDir, subFsDir)
134+
if _, err := os.Stat(dir); os.IsNotExist(err) {
135+
os.MkdirAll(dir, 0755)
136+
}
137+
return webdav.Dir(dir)
134138
}
135139

136140
func buildPathPrefix(path, userPrefix string) string {

0 commit comments

Comments
 (0)