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

Is there any way to view the file checksum from the drupal UI? #1102

Closed
Natkeeran opened this issue Apr 26, 2019 · 9 comments
Closed

Is there any way to view the file checksum from the drupal UI? #1102

Natkeeran opened this issue Apr 26, 2019 · 9 comments

Comments

@Natkeeran
Copy link
Contributor

Is there any way to view the file checksum from the drupal UI?

@mjordan
Copy link
Contributor

mjordan commented Apr 26, 2019 via email

@Natkeeran
Copy link
Contributor Author

Drupal. We have filehash enabled, thus I assume it calculates it. However, not sure where that info is stored.

If we have another way to display this info, that should be sufficient too.

@mjordan
Copy link
Contributor

mjordan commented Apr 26, 2019 via email

@dannylamb
Copy link
Contributor

IIRC it stores checksums in a separate table, but then stuffs them into the file entity early on so that it's available there (and not coming from a bookeeper or 'manager' service that you have to inject in). I think it also makes it available through views, so you could alter the main File view (admin/content/file) to include the hash in the results. Or just make a custom one.

And this is pure speculation on my part, but if you wanted it in the UI on Media display, maybe a pseudo field?

@Natkeeran
Copy link
Contributor Author

@dannylamb
http://localhost:8000/admin/content/files, yes able to add the checksum.

Is there a way to provide checksum and check it when a file gets uploaded via UI? Not an urgent issue. I remember that if a file or media gets created via REST, it will check the checksum.

@dannylamb
Copy link
Contributor

dannylamb commented Apr 26, 2019

The filehash module implements the file_validate hook to check the checksum of an uploaded file against existing checksums to dedupe: https://git.drupalcode.org/project/filehash/blob/8.x-1.x/filehash.module#L92 I imagine you could alter the form widget (or make another widget altogether) that has a text field where you can put a checksum. Then implement the file_validate hook and check for mismatch.

@mjordan
Copy link
Contributor

mjordan commented Apr 26, 2019

Also relevant is #867.

@dannylamb
Copy link
Contributor

Also, just realized that there's a field formatter for files included in the filehash module that can be used to render file fields as checksums. So we can display it on the Media as well, np.

@Natkeeran
Copy link
Contributor Author

@mjordan @dannylamb
Closing this ticket as 867 address this issue.

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

No branches or pull requests

3 participants