Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileNamesCheck #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>uk.ac.ebi.pride</groupId>
<artifactId>px-submission-core</artifactId>
<name>px-submission-core</name>
<version>2.0.35</version>
<version>2.0.36</version>

<parent>
<groupId>uk.ac.ebi.pride.architectural</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,14 @@ private static void validateDataFile(DataFile dataFile, ValidationReport report)
report.addMessage(new ValidationMessage(ValidationMessage.Type.ERROR, "# is not allowed in the file name '" + actualFile.getName() + "'"));
}

if (!dataFile.getFileName().matches("[^-_.A-Za-z0-9]")){
report.addMessage(new ValidationMessage(ValidationMessage.Type.WARNING, "POSIX compatible charset is NOT used in file name '" + actualFile.getName() + "'"));
if (dataFile.getFileName().matches("[^-_.A-Za-z0-9]")){
report.addMessage(new ValidationMessage(ValidationMessage.Type.ERROR, "POSIX compatible charset is NOT used in file name '" + actualFile.getName() + "'"));
Copy link
Contributor

@chakrabandla chakrabandla Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this error appear to user in submission tool? if the user is going to see text then it should be a more easily understandable sentence like only .-_ are allowed in a filename

Copy link
Contributor

@chakrabandla chakrabandla Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this logic disallows user to submit files? or more changes are needed in submission tool code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes sense will change it.

}

if (!dataFile.getFileName().matches("^[A-Za-z0-9].*")){
report.addMessage(new ValidationMessage(ValidationMessage.Type.ERROR, "Filenames should start with alpha numeric characters '" + actualFile.getName() + "'"));
}

} else if (!dataFile.isUrl()) {
// Accept URL
report.addMessage(new ValidationMessage(ValidationMessage.Type.ERROR, "Data file is not a file: " + dataFile.getFileId()));
Expand Down