Skip to content
Snippets Groups Projects
Commit 214a672d authored by Nicolas.Rod's avatar Nicolas.Rod
Browse files

fix(Fedora3Storage): do not delete files in Fedora if filenames are identical...

fix(Fedora3Storage): do not delete files in Fedora if filenames are identical but file size is wrong in Fedora
parent b14a8074
Branches
Tags
No related merge requests found
......@@ -588,6 +588,21 @@ public class Fedora3Storage extends StorageService {
if (nodeFilename.equals(oldFileName) && nodeSize.equals(oldSize)) {
deleteDs = false;
break;
} else {
// Some data are wrong in ADMIN datastream -> we do another check to prevent deleting files while it should not.
// Instead of getting the size in ADMIN datastream, we get the real size of the file in the datastream itself
String currentDsSize = this.getDatastreamSize(publication, oldAttachmentId);
if (nodeFilename.equals(oldFileName) && nodeSize.equals(currentDsSize)) {
// file names match. Size in the new ADMIN
deleteDs = false;
break;
} else if (nodeSize.equals(currentDsSize)) {
// Size is the same, but filename is different. It is maybe another file with the same size.
// We delete the file
} else {
// filename and size are different
// We delete the file
}
}
} else {
// Case of old publication with incomplete ADMIN datastream --> we delete a datastream only if no one with the same size exists anymore
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment