ppazos / cabolabs-ehrserver

Open platform to manage and share standardized clinical data, designed by @ppazos at CaboLabs Health Informatics.
https://cabolabs.com
Apache License 2.0
179 stars 110 forks source link

OPT delete on S3 is not updating the file location (key) with .deleted #1066

Closed ppazos closed 4 years ago

ppazos commented 4 years ago

Describe the bug

This should be fixed after the S3 branch is merged.

ppazos commented 4 years ago

Delete should not move he file but empty trash should, because if the file is moved and the OPTs get reindexed, the OPT index in the DB will be deleted, thus, the deleted OPT won't appear in the trash.

ppazos commented 4 years ago

The key is being set but it is not stored in S3 with the new name...

s3Object.setKey(opt.fileLocation + '.deleted')

That is in OptS3Service.emptyTrash()

ppazos commented 4 years ago

https://stackoverflow.com/questions/12176624/how-can-i-change-key-name-of-amazon-s3-object-using-rest-or-soap

The only way to rename an object is to copy the old object to a new object, and set the new name on the new copy.

Also check copy operation: https://stackoverflow.com/questions/32646646/how-do-i-update-metadata-for-an-existing-amazon-s3-file

ppazos commented 4 years ago

The issue was solved by copying then delete the old object.

ppazos commented 4 years ago

Done.