From 0e177a44e0ad2ed8e4cee959685814f9206ec5fb Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 12 Feb 2024 08:30:40 -0800 Subject: [PATCH] preserve conflicting objects when parent object is being deleted (#19034) a/prefix a/prefix/1.txt where `a/prefix` is an object which does not have `/` at the end, we do not have to aggressively recursively delete all the sub-folders as well. Instead convert the call into self contained to deleting 'xl.meta' and then subsequently attempting to Remove the parent. --- cmd/xl-storage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index 4fb6ab8cf..7bfa7dfa0 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -1146,7 +1146,7 @@ func (s *xlStorage) deleteVersions(ctx context.Context, volume, path string, fis return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf) } - return s.deleteFile(volumeDir, pathJoin(volumeDir, path), true, false) + return s.deleteFile(volumeDir, pathJoin(volumeDir, path, xlStorageFormatFile), true, false) } // DeleteVersions deletes slice of versions, it can be same object @@ -1307,7 +1307,7 @@ func (s *xlStorage) DeleteVersion(ctx context.Context, volume, path string, fi F return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf) } - return s.deleteFile(volumeDir, filePath, true, false) + return s.deleteFile(volumeDir, pathJoin(volumeDir, path, xlStorageFormatFile), true, false) } // Updates only metadata for a given version.