From 3c8ece72ccd79d1f80c72a4d4e19dc3c68dd125e Mon Sep 17 00:00:00 2001 From: Niklas Date: Mon, 16 Aug 2021 02:04:44 +0200 Subject: [PATCH] move mutation dest dir fix --- internal/mutations.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/mutations.go b/internal/mutations.go index a92108f..b593b62 100644 --- a/internal/mutations.go +++ b/internal/mutations.go @@ -70,6 +70,13 @@ func moveMutation(ctx context.Context, src, dest string) (*File, error) { return nil, fmt.Errorf("Failed to get s3Client from context") } + // Check if dest is a file or a dir + if strings.HasSuffix(dest, "/") { + // create new dest id + // TODO: What if a file with this id already exists? + dest += getFilenameFromID(src) + } + // There is no (spoon) move. Only copy and delete info, err := s3Client.CopyObject(ctx, minio.CopyDestOptions{ Bucket: bucketName,