From d845824bd8998dd4c7e3327e06f3573c916320ff Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 26 Apr 2022 19:07:23 +0800 Subject: [PATCH] fix: overwrite should be disabled when copy on write --- pkg/webdav/webdav.go | 1 + service/explorer/file.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/webdav/webdav.go b/pkg/webdav/webdav.go index 8b248e4..208bd12 100644 --- a/pkg/webdav/webdav.go +++ b/pkg/webdav/webdav.go @@ -362,6 +362,7 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request, fs *filesyst if err == nil && len(fileList) == 0 { // 如果包含软连接,应重新生成新文件副本,并更新source_name originFile.SourceName = fs.GenerateSavePath(ctx, &fileData) + fileData.Mode &= ^fsctx.Overwrite fs.Use("AfterUpload", filesystem.HookUpdateSourceName) fs.Use("AfterUploadCanceled", filesystem.HookUpdateSourceName) fs.Use("AfterValidateFailed", filesystem.HookUpdateSourceName) diff --git a/service/explorer/file.go b/service/explorer/file.go index f79c2f0..b58185b 100644 --- a/service/explorer/file.go +++ b/service/explorer/file.go @@ -401,6 +401,7 @@ func (service *FileIDService) PutContent(ctx context.Context, c *gin.Context) se if err == nil && len(fileList) == 0 { // 如果包含软连接,应重新生成新文件副本,并更新source_name originFile[0].SourceName = fs.GenerateSavePath(uploadCtx, &fileData) + fileData.Mode &= ^fsctx.Overwrite fs.Use("AfterUpload", filesystem.HookUpdateSourceName) fs.Use("AfterUploadCanceled", filesystem.HookUpdateSourceName) fs.Use("AfterValidateFailed", filesystem.HookUpdateSourceName)