-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix race-condition when loading local images #29595
Fix race-condition when loading local images #29595
Conversation
In local images, the callback is called inline, and so requestToken is always nil at the time the block is executed. In this case, the requestToken is irrelevant because the task is completed before it could be canceled. So initializing it with a do-nothing block satisfies the delegate. It could also be a race condition even if the block is called on another thread, and so I also add @synchronized to protect against that race as well. Fixes facebook#29364 "Missing request token for request: <NSURLRequest: 0x60000253e5a0> { URL: file://"
Hi @paddlefish! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
I agreed to the CLA |
Base commit: 0416f77 |
Base commit: 0416f77 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works perfectly!
Any plans when this PR will be part of the next patch release? |
@shergin could you please review this? its impossible to upload local images anymore in the current rn version... |
Any updates on this PR? Have been waiting for this to be merged for quite some time now. |
For IOS in Replace Below
return nil; With
This.. Like and Love , if it work 👍 |
@shergin we hate to keep bothering you! This is affecting many folks (I see at least 5 different open tickets relating to this with comments from hundreds of folks). Seems like this is a simple fix/PR? Uploading images is completely broken on iOS via fetch and many applications depend on this functionality (we can't release our app until this one gets merged). Appreciate all your hard work! |
Any updates on timing for this being merged and released? We are midway through upgrading to 0.63.2 and this has become a blocker for us. We are not super comfortable with any of the work arounds presented, unless you can convince us of the stability for pegging package.json to use the nightly builds. We appreciate all of your help and hard work on this, and many more issues! |
v0.63.3 is out and this hasn't been merged yet. |
@ThukuWakogi some ppl already reported that 0.63.3 fixes this issue. Haven’t tried it but there’s a chance 🤞 edit: it's fixed for me for uploading form-data image using axios |
Version 0.63.3 does not fix this issue, but this PR does. Would be good to get this merged soon. Currently we have to always manually modify the correct files in node_modules before building. It would be great to not have to do that every time |
Any updates on this? Comment: |
This should be closed. The issue was fixed another way |
In local images, the callback is called inline, and so requestToken is always nil at the time the block is executed. In this case, the requestToken is irrelevant because the task is completed before it could be canceled. So initializing it with a do-nothing block satisfies the delegate.
It could also be a race condition even if the block is called on another thread, and so I also add @synchronized to protect against that race as well.
Fixes #29364 "Missing request token for request: <NSURLRequest: 0x60000253e5a0> { URL: file://"
Summary
Loading a local image will fail with an error "Missing request token for request:"
Changelog
[iOS] [Fixed] - Fix error thrown in RCTImageLoader.mm when accessing a file:// url
Test Plan
I have a react-native app which loads images from the camera roll using
react-native-image-picker
. When I addedmaxWidth: 480, maxHeight: 480,
parameters this error started appearing. This code commit fixes that issue.