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