fix: overwrite should be disabled when copy on write

pull/1257/head
HFO4 3 years ago
parent ae33e077a3
commit d845824bd8

@ -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)

@ -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)

Loading…
Cancel
Save