Fix/prevent same data uploads#262
Merged
joaorafaelalmeida merged 3 commits intoEHDEN:devfrom Jan 5, 2023
Merged
Conversation
… with latest uploaded file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds hash mechanism to prevent the user or database owner to upload the same data or the same file, equal to the one already in the database, in the dashboards uploader.
Description
This PR adds a new check mechanism when a file is uploaded, namely by verifying if the data or file uploaded
is equal to the stored data for the data source, by evaluating the hashed contents of the uploaded file and
the file previous uploaded to the database, if it exists.
This new step was implemented to act before every other check, such as the metadata ones, which allows
that if the same file is uploaded, the processing can immediately terminate, with no need to
process the other checks, as the upload process will fail.
For now the message presented in the uploader page in the case of a duplicated file is "File is already
present in the database".
Related Issue
Fixes #260
Motivation and Context
The upload of files into the Network Dashboards can become computationally intensive process, in the case of large data, especially due to the refresh of the materialized views that occurs after each upload to incorporate the new data
in the graphic representations. By preventing the dashboard owners to upload the same data and the same files,
we are potentially saving server resources.
How Has This Been Tested?
Unit Tests:
process.
Testing Environment:
Affected areas of the code: