0x6b / copy-selection-as-markdown

Firefox add-on to copy selection as Markdown
https://addons.mozilla.org/en-US/firefox/addon/copy-selection-as-markdown/
MIT License
190 stars 14 forks source link

Fix CORS issue when trying to convert images to base64 #103

Open alexanderadam opened 2 years ago

alexanderadam commented 2 years ago

Hi 0x6b,

I hope you're fine.

Actual Result

I tried to copy something and it failed due to a CORS rule when trying to fetch images.

I guess the safest variant would be to read the already loaded images from the DOM (and also faster).

Otherwise APIs to fetch data can often decide whether they go with or without CORS. Is the referring domain is always localhost or something like that? Anyway, most libraries and native APIs can set something like the no-cors property and disable the check in this case.

Otherwise it might be possible to set the Referer HTTP header to the current domain in these requests.

Expected Result

No CORS errors. :wink: