Closed tarikbuza closed 5 years ago
I understand the scope of what you are presenting. I've not come across a situation in which event.originalEvent was undefined, that I know of.
Upfront, maybe the answer is to just check that eventToTransfer
returned something. However, what's causing event.originalEvent to be undefined I think is the greater concern... Perhaps the "fix" is to use event
when event.originalEvent
is undefined?
I am unsure how to proceed and no time available to devote. Just lost my job. A pull request will be needed if you need this fixed
Problem occurs when I use file picker inside the container with ngfDrop
directive. Then comes this error. There should be a check for null
, since there is a case in which it is returned from eventToTransfer
function. In case transfer is null, simply returning [];
solves the problem for me. I would really need this pull request.
it sounds like you know what's up. Do you know how to fork and then pull request? If so, please do and I will test and publish
Just in case, here is a great video on how easy it is to fork and then make a pull request: https://www.youtube.com/watch?v=dSl_qnWO104
Thank you for the link, I have created the pull request.
You almost did. Some how the pull request is within your fork. BUT it should be a pull request against my package. Like it’s 99% right but you selected one wrong option at the end I think.
Your pull request is appearing incorrectly here: https://github.com/tarikbuza/angular-file/pulls
When it actually needs to be seen here: https://github.com/AckerApple/angular-file/pulls
Where your pull request is right now, only you can work with it. When you correctly issue a pull request to my package, I will get merge controls
Ah I see it now, thanks. Must have done something wrong. Is it okay now?
Merged pull request. Issue should be resolved
Thank you very much once again :grinning:
https://github.com/AckerApple/angular-file/blob/79e3a71f14e6c8e9db579bfd716f19da13c54bda/src/file-upload/ngf.directive.ts#L220-L223
When
event.dataTransfer
orevent.originalEvent.dataTransfer
areundefined
ornull
, functioneventToTransfer
returnsnull
. Then, there is no check if variabletransfer
is null or not in functioneventToFiles
. This leads to'Cannot read property 'files' of null'
error.https://github.com/AckerApple/angular-file/blob/0462b824eedc1dd5f1e43b3ff5b12b7d5ecdab40/src/file-upload/ngf.directive.ts#L252-L257