ngx-file-drop
ngx-file-drop copied to clipboard
Missing file when dragged from browser
The file is missing when I drag a file from the browser, for example an image is dragged and dropped from a google image search result page to the dropzone.
Maybe related issue:
- https://github.com/georgipeltekov/ngx-file-drop/issues/289
Versions:
ngx-file-drop: 16.0.0angular: 16.1.3chrome: 115.0.5790.171
I debugged the issue and this is what I found.
https://github.com/georgipeltekov/ngx-file-drop/blob/99180cf988e72654f59618d8a97d6ccd052f04c9/projects/ngx-file-drop/src/lib/ngx-file-drop.component.ts#L203-L230
checkFile is called, but item.webkitGetAsEntry() returns null, so it uses the fallback to pass the DataTransferItem raw.
The (onFileDrop) output emits this DataTransferItem but it is empty (if it was not empty then I could have made a workaround for this bug).
There was a pull request to use getAsFile which seems to work for my use case https://github.com/georgipeltekov/ngx-file-drop/pull/263, but it was reverted https://github.com/georgipeltekov/ngx-file-drop/commit/adcb50416b284df612764d3d3786d92aff845f6d (https://github.com/georgipeltekov/ngx-file-drop/issues/268).
I'd be happy to create a pull request to fix this issue: use getAsFile but code it so it does not break folder uploads, maybe running it only when item.webkitGetAsEntry() == null would sidestep the problem.
Darn, think we're hitting this issue.
Are you aware of any workaround as the PR seems to be sitting un-merged? It's sort of a killer issue.
@georgipeltekov sorry to bother you, any chance of looking into this / getting the linked PR merged & released?