From b3404608d1b7879749952d14dd1a72f6d5584201 Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Thu, 14 Oct 2021 15:02:58 +0200 Subject: [PATCH] do not remove file data from s3 storage if DELETE is executed for file --- routes/file/file_methods.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/routes/file/file_methods.go b/routes/file/file_methods.go index 5803db8..788d123 100644 --- a/routes/file/file_methods.go +++ b/routes/file/file_methods.go @@ -227,11 +227,15 @@ func (f *File) Delete() error { // delete file from s3 bucket if f.Key != "" { - err = f.deleteS3() - if err != nil { - return err - } - log.Println("Deleted file in S3 object storage") + // TODO we do not delete the file from s3 object storage + // to ensure that no data is lost if multiple File objects reference the same S3 data object + // This behavior should be replaced by a different file handling in the future + //err = f.deleteS3() + //if err != nil { + // return err + //} + //log.Println("Deleted file in S3 object storage") + log.Println("Did NOT delete file in S3 object storage!") } err = db.Model(&so).Association("Files").Delete(f).Error