Feat: support apply append mode and overwrite mode for FileStream

This commit is contained in:
HFO4
2022-02-28 17:49:00 +08:00
parent 285611baf7
commit 118d738797
16 changed files with 32 additions and 41 deletions

View File

@@ -51,7 +51,7 @@ func (fs *FileSystem) Upload(ctx context.Context, file *fsctx.FileStream) (err e
go fs.CancelUpload(ctx, savePath, file)
// 保存文件
if file.Mode != fsctx.Nop {
if file.Mode&fsctx.Nop != fsctx.Nop {
err = fs.Handler.Put(ctx, file)
if err != nil {
fs.Trigger(ctx, "AfterUploadFailed", file)
@@ -73,7 +73,7 @@ func (fs *FileSystem) Upload(ctx context.Context, file *fsctx.FileStream) (err e
return err
}
if file.Mode == fsctx.Create {
if file.Mode&fsctx.Overwrite == 0 {
fileInfo := file.Info()
util.Log().Info(
"新文件PUT:%s , 大小:%d, 上传者:%s",