-
Notifications
You must be signed in to change notification settings - Fork 397
Add file download validation #1024
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
Add file download validation #1024
Conversation
Currently, we validate the file size only. We could validate the content using any hashing function later.
josemduarte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you and sorry about the delays. I can't find much time for biojava lately.
I think the size validation is a good idea and general enough. However the hash validation is not general, it depends on different resources providing one. There's no standard way of doing that at the moment. I'd advise removing the whole hash validation. There's no point in having it around if it won't be applicable.
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Show resolved
Hide resolved
Typos, wording, and version correction
The expected hashing algorithms are MD5, SHA1, and SHA256
josemduarte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes and again apologies for the delays. Ok I think we could keep this as is for next release. Please note a couple of minor issues with logging and version number
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
Outdated
Show resolved
Hide resolved
josemduarte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
When a file is being downloaded, two metadata files are created for size and hash (as possible).
I applied this validation framework to the files I know (structure files, SCOP installations, Ecod installation).
In case anybody knows something else where downloaded files can be validated, please advise.
I did not implement the hash code at least yet, because I don't know a place where a hash file is distributed with the resource file. In case anybody knows some example, please advise.
@sbliven was proposing to download to a temporary file before moving the load to the destination file. I found that
FileDownloadUtils.downloadFile()does. Therefore, no need to do it ourselves. again, in case anybody knows a place which downloads files but does not useFileDownloadUtils.downloadFile()for download, please advise.fixes #980.