revert: undo delete upFileMap

pull/787/head
Xhofe 2022-03-17 21:56:50 +08:00
parent f4f61a5787
commit 908cdd2c78
1 changed files with 8 additions and 0 deletions

View File

@ -24,8 +24,13 @@ import (
type FileSystem struct{}
var upFileMap = make(map[string]*model.File)
func (fs *FileSystem) File(rawPath string) (*model.File, error) {
rawPath = utils.ParsePath(rawPath)
if f, ok := upFileMap[rawPath]; ok {
return f, nil
}
if model.AccountsCount() > 1 && rawPath == "/" {
now := time.Now()
return &model.File{
@ -170,7 +175,10 @@ func (fs *FileSystem) Upload(ctx context.Context, r *http.Request, rawPath strin
}
if fileSize == 0 {
// 如果文件大小为0默认成功
upFileMap[rawPath] = fi
return fi, nil
} else {
delete(upFileMap, rawPath)
}
fileData := model.FileStream{
MIMEType: r.Header.Get("Content-Type"),