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

Getting file/image from clipboard #134

Open
jimmywarting opened this issue Nov 17, 2020 · 1 comment
Open

Getting file/image from clipboard #134

jimmywarting opened this issue Nov 17, 2020 · 1 comment

Comments

@jimmywarting
Copy link

I stumble up on something abnormal behavior when i tried to copy a jpeg with exif rotation and reading it from the clipboard api.

First of all, when i read the image then I always got a png file even doe i had copied a jpeg file.
I can see from this paragraph that jpg/jpeg should be whitelisted. So why don't i get the original jpeg file back when i read it from the clipboard?

Chrome seems to convert all images into a png file? (why?) and wrongly too. it dose not rotate the image according to the exif rotation in the jpeg meta data.

And why is the file name not the same as the original file i copied? all images i copy get the name image.png?

@dway123
Copy link

dway123 commented Nov 25, 2020

This repository concerns the w3c clipboard specification, which applies to all browsers (ex. Chrome, Safari, Firefox, Edge, Samsung Internet, etc). Are you discussing a Chromium-specific bug? If so, please file a bug on https://crbug.com (component Blink>DataTransfer for clipboard), and we can close this issue. If this is intended to be a cross-browser spec issue, please leave this here.

Generally, browsers will sanitize clipboard contents to prevent security issues (ex. remote code execution vulnerabilities in image encoders), so sites can't expect clipboard contents to have be completely preserved/identical after copying/pasting. One unfortunate side effect of this is that exif rotation and other metadata is commonly stripped, and browser-internal formats may sometimes differ from formats used on the web (Chrome happens to prefer bitmaps/PNGs for clipboard image formats).

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