Skip to content

Commit

Permalink
#4813 add warnings when dup content added in same upload session
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Jul 15, 2020
1 parent dab96ab commit 6e7c3b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,8 @@ private String processUploadedFileList(List<DataFile> dFileList) {
// deleteTempFile(dataFile);
dataFile.setMarkedAsDuplicate(true);
dataFile.getFileMetadata().setMarkedAsDuplicate(true);
String inLineMessage = getBundleString("dataset.file.inline.message.prefix") + " " + existingFile.getDisplayName();
dataFile.setDuplicateFilename(inLineMessage);
} else {
// OK, this one is not a duplicate, we want it.
// But let's check if its filename is a duplicate of another
Expand Down Expand Up @@ -2360,7 +2362,7 @@ private String processUploadedFileList(List<DataFile> dFileList) {
List<String> args = Arrays.asList(uploadedFilesWithDupeContentToExisting, existingFilesWithDupeContent);

if (multipleDupesExisting) {
duplicateFilesErrorMessage = BundleUtil.getStringFromBundle("dataset.files.exis", args);
duplicateFilesErrorMessage = BundleUtil.getStringFromBundle("dataset.files.exist", args);
} else {
duplicateFilesErrorMessage = BundleUtil.getStringFromBundle("dataset.file.exist", args);
}
Expand All @@ -2370,22 +2372,23 @@ private String processUploadedFileList(List<DataFile> dFileList) {
warningMessage = warningMessage.concat("; " + duplicateFilesErrorMessage);
}
}
/*
if (dupeFileNamesNew != null) {

if (newlyUploadedFilesWithDupeContent != null) {
String duplicateFilesErrorMessage = null;
if (multipleDupesNew) {
duplicateFilesErrorMessage = getBundleString("dataset.files.duplicate") + dupeFileNamesNew ;
List<String> args = Arrays.asList(newlyUploadedFilesWithDupeContent, uploadedFilesWithDupeContentToNewlyUploaded);

if (multipleDupesNew) {
duplicateFilesErrorMessage = BundleUtil.getStringFromBundle("dataset.files.duplicate", args);
} else {
duplicateFilesErrorMessage = getBundleString("dataset.file.duplicate") + dupeFileNamesNew ;
duplicateFilesErrorMessage = BundleUtil.getStringFromBundle("dataset.file.duplicate", args);
}
if (warningMessage == null) {
warningMessage = duplicateFilesErrorMessage;
} else {
warningMessage = warningMessage.concat("; " + duplicateFilesErrorMessage);
}
}
*/

if (warningMessage != null) {
logger.severe(warningMessage);
return warningMessage;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2111,8 +2111,8 @@ dataset.save.fail=Dataset Save Failed

dataset.files.exist=Files {0} have the same content as {1} that already exist in the dataset.
dataset.file.exist=File {0} has the same content as {1} that already exists in the dataset.
dataset.files.duplicate=The following files have content identical to (an) already uploaded file(s):
dataset.file.duplicate=The following file has identical content to an already uploaded file:
dataset.files.duplicate=Files {0} have the same content as {1} that have already been uploaded.
dataset.file.duplicate=File {0} has the same content as {1} that has already been uploaded.
dataset.file.inline.message.prefix= This file has the same content as
dataset.file.skip=(skipping)
dataset.file.upload=Succesful {0} is uploaded.
Expand Down

0 comments on commit 6e7c3b9

Please sign in to comment.