|
|
@ -3,6 +3,7 @@ package filesystem
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/HFO4/cloudreve/pkg/util"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// GenericBeforeUpload 通用上传前处理钩子,包含数据库操作
|
|
|
|
// GenericBeforeUpload 通用上传前处理钩子,包含数据库操作
|
|
|
@ -33,9 +34,11 @@ func GenericBeforeUpload(ctx context.Context, fs *FileSystem, file FileData) err
|
|
|
|
func GenericAfterUploadCanceled(ctx context.Context, fs *FileSystem, file FileData) error {
|
|
|
|
func GenericAfterUploadCanceled(ctx context.Context, fs *FileSystem, file FileData) error {
|
|
|
|
filePath := ctx.Value("path").(string)
|
|
|
|
filePath := ctx.Value("path").(string)
|
|
|
|
// 删除临时文件
|
|
|
|
// 删除临时文件
|
|
|
|
_, err := fs.Handler.Delete(ctx, []string{filePath})
|
|
|
|
if util.Exists(filePath) {
|
|
|
|
if err != nil {
|
|
|
|
_, err := fs.Handler.Delete(ctx, []string{filePath})
|
|
|
|
return err
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 归还用户容量
|
|
|
|
// 归还用户容量
|
|
|
|