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

Add a controller to get a file's hash #33

Closed
mjordan opened this issue Aug 19, 2020 · 3 comments
Closed

Add a controller to get a file's hash #33

mjordan opened this issue Aug 19, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@mjordan
Copy link
Owner

mjordan commented Aug 19, 2020

#32 gets the hash from the hash that Drupal has stored. That hash may have been accurate at the time the file was ingested but we want the current hash of the file.

To do this we need to add a controller that generates a hash for a file. This controller should have two parameters, the digest algorithm and the file's UUID.

@mjordan mjordan added the enhancement New feature or request label Aug 19, 2020
@mjordan
Copy link
Owner Author

mjordan commented Aug 19, 2020

Added. Syntax is curl -v -uadmin:islandora "http://localhost:8000/islandora_riprap/checksum/{file_uuid}/{algorithm}", e.g., curl -v -uadmin:islandora "http://localhost:8000/islandora_riprap/checksum/7bf32c29-8b2f-4ec1-b3f7-df88a8bdca56/sha256"

Response from this request is [{"checksum":"f20ef9a5b3fbd2d61effa147e528189bb1d544a40784d5c4d4089c5f18acc772","file_uuid":"7bf32c29-8b2f-4ec1-b3f7-df88a8bdca56","algorithm":"sha256", "url":"http:\/\/localhost:8000\/sites\/default\/files\/2020-08\/7-Extracted%20Text.txt"}].

Algorithm is one of 'md5', 'sha1', or 'sha256', the ones supported by the filehash module. Access requires the view checksums permission.

mjordan added a commit that referenced this issue Aug 19, 2020
@mjordan
Copy link
Owner Author

mjordan commented Aug 19, 2020

Gonna remove the View created added in #32 since this new controller replaces it.

@mjordan
Copy link
Owner Author

mjordan commented Aug 19, 2020

Resolved with f713b25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant