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

Silent Upload Failure if window.crypto.subtle Not Available #50

Closed
mutewinter opened this issue Sep 21, 2021 · 1 comment
Closed

Silent Upload Failure if window.crypto.subtle Not Available #50

mutewinter opened this issue Sep 21, 2021 · 1 comment

Comments

@mutewinter
Copy link

Heads-up that I got caught by this TODO: https://github.com/robinpyon/sanity-plugin-media/blob/master/src/modules/uploads/index.ts#L198

Turns out if you use a custom domain locally like http://my-site.test:3000, window.crypto.subtle isn't defined in that environment. Instead, you have to use localhost:3000 when using this plugin. It would be nice if there were a Toasted error message if the file hash generation fails. Or perhaps even disable upload entirely if the crypto APIs aren't available.

@robinpyon
Copy link
Collaborator

Great catch, thank you for flagging this @mutewinter.

A toast will now be displayed when trying to generate hashes / upload files from within insecure contexts in 1.4.11

robinpyon added a commit that referenced this issue Oct 6, 2022
- fix: correctly infer filename from files containing uppercase extensions, tweak upload card layout
- fix: fix minor regression with tag positioning, dont portal tooltips to prevent overflow issues
- ci: add semver automation workflow
- fix: catch errors when preview images fail to be generated (#88)
- fix: throw an error when trying to call window.crypto from insecure contexts (#50)
- fix: don't hardcode z-indices, correctly render last filter item (#57, #82)
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

2 participants