自动创建用户目录
This commit is contained in:
parent
ae389aebe8
commit
6ce95c60cd
@ -452,12 +452,17 @@ func newFileDownloadWriter(stream filesApi.File_DirDownloadServer) *fileDownload
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFs(UserSpacePath string) afero.Fs {
|
func getFs(userSpacePath string) afero.Fs {
|
||||||
bashAbs, _ := filepath.Abs(BASE_PATH)
|
bashAbs, _ := filepath.Abs(BASE_PATH)
|
||||||
if !strings.HasPrefix(UserSpacePath, "/") {
|
|
||||||
UserSpacePath = "/" + UserSpacePath
|
if !strings.HasPrefix(userSpacePath, "/") {
|
||||||
|
userSpacePath = "/" + userSpacePath
|
||||||
}
|
}
|
||||||
return afero.NewBasePathFs(afero.NewOsFs(), bashAbs+UserSpacePath)
|
_, err := os.Stat(bashAbs + userSpacePath)
|
||||||
|
if err != nil {
|
||||||
|
os.MkdirAll(bashAbs+userSpacePath, os.ModeDir)
|
||||||
|
}
|
||||||
|
return afero.NewBasePathFs(afero.NewOsFs(), bashAbs+userSpacePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkParent(src, dst string) error {
|
func checkParent(src, dst string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user