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

Image add crossOrigin settings (#143) #324

Merged
merged 5 commits into from
Mar 16, 2024
Merged

Image add crossOrigin settings (#143) #324

merged 5 commits into from
Mar 16, 2024

Conversation

catmiao8
Copy link
Contributor

No description provided.

@zpao
Copy link
Owner

zpao commented Nov 11, 2023

Please describe what your change is achieving / what problem this solves

@zpao
Copy link
Owner

zpao commented Nov 12, 2023

Oh I see this is for #143. Looks like you just made the changes in SVG, not Canvas

@catmiao8
Copy link
Contributor Author

Oh I see this is for #143. Looks like you just made the changes in SVG, not Canvas

Sorry, I forgot to change the canvas. It has been modified now.

@catmiao8 catmiao8 reopened this Nov 13, 2023
@catmiao8
Copy link
Contributor Author

Hello, are there any questions about this PR?

src/index.tsx Outdated
@@ -344,6 +348,7 @@ const QRCodeCanvas = React.forwardRef(function QRCodeCanvas(
setIsImageLoaded(true);
}}
ref={_image}
crossOrigin={imageSettings?.crossOrigin ?? 'anonymous'}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love that this is duplicating the work in getImageSettings. I'd need to see if we can pull the call to that out of our useEffect in here or maybe just pull the default setting out to ensure no potential drift.

src/index.tsx Outdated Show resolved Hide resolved
@zpao
Copy link
Owner

zpao commented Feb 25, 2024

I was playing around some more and unfortunately hit the one easy case where this is a problem: localhost out to the web (at least on my webserver which is used in the example code to fetch my favicon). Need to think about it a bit more. Defaulting to anonymous is probably the best behavior but it would break some set of use cases. As is we would have no way to enable the broken use cases since it's only by omission of the property that it works, so would probably want to end up supporting null as a value with explicit intent, leaving undefined to hit the default value path.

This ensures we have expected snapshots with values and that empty
string maps to anonymous.
@zpao zpao merged commit 5551bea into zpao:trunk Mar 16, 2024
10 checks passed
@kiner-tang
Copy link

The same issue in antd: ant-design/ant-design#48759.
When will we release a version to support this?

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.

SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
3 participants