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

Fix image uploads being random data when canvas read access is blocked #15180

Merged

Conversation

ClearlyClaire
Copy link
Contributor

Fixes #15178

PR #11499 introduced a way to deal with all-white canvas, but newer Firefox versions set random data instead.

This PR detects whether canvas operations are reliable by comparing the results on a hardcoded 2×2 pixels image, and memoizing the result.

This should be both more reliable and faster than the previous check.

Fixes mastodon#15178

PR mastodon#11499 introduced a way to deal with all-white canvas, but newer
Firefox versions set random data instead.

This PR detects whether canvas operations are reliable by comparing
the results on a hardcoded 2×2 pixels image, and memoizing the result.

This should be both more reliable and faster than the previous check.
@Gargron Gargron merged commit d8d43a4 into mastodon:master Nov 18, 2020
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

Successfully merging this pull request may close these issues.

uploading images result in a colored background
2 participants