Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check if pastedFile is a file before run getAsFile #16

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

Merged
merged 2 commits into from
Sep 23, 2021

Conversation

duduribeiro
Copy link
Contributor

Received from two friends (@michel-gatti and @fpgentil) that since ~ 2 weeks ago they can't Paste Print Screens direct on inputs that uses file-attachment-element.

Both are using linux. @michel-gatti is using Mint with chrome Version 93.0.4577.82 (Official Build) (64-bit) and @fpgentil is using Fedora 34 - Gnome 40.4.0 - Kernel 5.13.14-200.fc34.x86_64 with a clipboard manager tool called flameshot

Both says that they can paste the files from screenshot in other browser apps (like Google Docs) but not on fields that uses file-attachment-element.

@michel-gatti made some tests and looks like his clipboard manager / browser is sending all these DataTransferItem when pasting

This patch on the file-attachment-element gets only the datatransferitem that is really a FILE before run getAsFile

I've tested with him and after this patch it got work again

@duduribeiro duduribeiro requested a review from a team as a code owner September 23, 2021 15:30
@duduribeiro duduribeiro requested review from srt32 and dgreif September 23, 2021 15:30
Copy link
Contributor

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

Thanks @duduribeiro appreciate the patch!

LGTM. Maybe some additional tests here - using some of the sample data you have?

@duduribeiro
Copy link
Contributor Author

@keithamus nice idea. I've added a new test on it. Also checked and the test fails when we remove the patch from file-attachment-element.ts

@dgreif dgreif merged commit d684125 into github:main Sep 23, 2021
@duduribeiro duduribeiro deleted the bug-fix branch September 27, 2021 13:45
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.

3 participants