-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Image] Can't display avatar with HTTP 301 #5616
Comments
Hey just4fun, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
@just4fun I'm having the same problem, images without extension aren't showed. Did you resolve the issue? |
@k7k0 No, there is no feedback both on Github issue and StackOverflow. @ide Any ideas? |
@just4fun on my case it turned to be a file-format problem, it's a WebP file instead of regular JPG. Not supported on iOS yet http://stackoverflow.com/questions/34815053/load-remote-image-without-extension/34825697#34825697 |
@k7k0 thank you, in my case, there is no any extension, the url seems like a PHP method. |
I think the issue here is not the type, but redirect that happens and that might not be supported in RN itself. If you could display image straight away w/o redirecting, that should solve the problem. |
@grabbou yes, there is no extension but redirect in my case, I also think it's not supported well in RN. But sometimes it works well, it's weird. |
I tried to display Seems like RN didn't support the redirect well even in latest 0.21. |
@facebook-github-bot bugfix |
Hey @just4fun, we're a small team and rely on the community to fix issues that don't affect fb apps. If you're sure this is a bug can you send a pull request with a fix? |
#7262 should fix this problem. |
@hayeah Thank you, but I found your PR has been closed? |
GitHub bot closes PRs and merges them manually - see the commit reference above :) |
@just4fun the PR is merged |
Summary: + Fixes facebook#5616 + Bug RNPlay Demo: https://rnplay.org/apps/Eg2goQ Test demo loads a Tumblr avatar image using a URL that 301 to a CDN. Try to edit and save the file to trigger image reloads. The 302 image request succeeds the first time: <img width="318" alt="screen shot 2016-04-27 at 9 37 03 am" src="https://cloud.githubusercontent.com/assets/50120/14860038/b2c04e8a-0c5b-11e6-9edf-78309048368b.png"> But it fails for subsequent loads. You should see: <img width="307" alt="screen shot 2016-04-27 at 9 37 22 am" src="https://cloud.githubusercontent.com/assets/50120/14860048/b756e170-0c5b-11e6-9031-8f3cca8f2994.png"> + The first image is a 302, only succeeds to load the first time. + The second image in the column adds a nonce as request parameter to render caching ineffective (but still a 302), and the problem doesn't occur. + The last image is the canonical url location (200). Although NSURLSession hand Closes facebook#7262 Differential Revision: D3231702 Pulled By: javache fb-gh-sync-id: 364fcf9819188c63310768411d49e6431b2a01d3 fbshipit-source-id: 364fcf9819188c63310768411d49e6431b2a01d3
Summary: + Fixes facebook#5616 + Bug RNPlay Demo: https://rnplay.org/apps/Eg2goQ Test demo loads a Tumblr avatar image using a URL that 301 to a CDN. Try to edit and save the file to trigger image reloads. The 302 image request succeeds the first time: <img width="318" alt="screen shot 2016-04-27 at 9 37 03 am" src="https://cloud.githubusercontent.com/assets/50120/14860038/b2c04e8a-0c5b-11e6-9edf-78309048368b.png"> But it fails for subsequent loads. You should see: <img width="307" alt="screen shot 2016-04-27 at 9 37 22 am" src="https://cloud.githubusercontent.com/assets/50120/14860048/b756e170-0c5b-11e6-9031-8f3cca8f2994.png"> + The first image is a 302, only succeeds to load the first time. + The second image in the column adds a nonce as request parameter to render caching ineffective (but still a 302), and the problem doesn't occur. + The last image is the canonical url location (200). Although NSURLSession hand Closes facebook#7262 Differential Revision: D3231702 Pulled By: javache fb-gh-sync-id: 364fcf9819188c63310768411d49e6431b2a01d3 fbshipit-source-id: 364fcf9819188c63310768411d49e6431b2a01d3
Summary: + Fixes facebook#5616 + Bug RNPlay Demo: https://rnplay.org/apps/Eg2goQ Test demo loads a Tumblr avatar image using a URL that 301 to a CDN. Try to edit and save the file to trigger image reloads. The 302 image request succeeds the first time: <img width="318" alt="screen shot 2016-04-27 at 9 37 03 am" src="https://cloud.githubusercontent.com/assets/50120/14860038/b2c04e8a-0c5b-11e6-9edf-78309048368b.png"> But it fails for subsequent loads. You should see: <img width="307" alt="screen shot 2016-04-27 at 9 37 22 am" src="https://cloud.githubusercontent.com/assets/50120/14860048/b756e170-0c5b-11e6-9031-8f3cca8f2994.png"> + The first image is a 302, only succeeds to load the first time. + The second image in the column adds a nonce as request parameter to render caching ineffective (but still a 302), and the problem doesn't occur. + The last image is the canonical url location (200). Although NSURLSession hand Closes facebook#7262 Differential Revision: D3231702 Pulled By: javache fb-gh-sync-id: 364fcf9819188c63310768411d49e6431b2a01d3 fbshipit-source-id: 364fcf9819188c63310768411d49e6431b2a01d3
I created an iOS APP for university BBS (built in PHP) with React Native 0.14.
When I send request to fetch user info, I will get a record including filed
avatar
, which has value likehttp://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle
, and I assigned it tosource
filed of<Image>
like below,Updated recently:
It seems like a PHP method (I'm not familiar with PHP), since the value ofavatar
will becomehttp://bbs.uestc.edu.cn/uc_server/data/avatar/000/03/20/44_avatar_middle.jpg
if I type the original value in the browser.I tried to display
http://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle
in html with<img> tag
, it will get 301 code and then get the right picture with extension.However, the avatar is not displayed sometimes with RN. See the screenshot.
Seems like RN didn't support the redirect well even in latest 0.21.
Does the
<Image>
component only support static picture file which ends withjpg|png|gif
?The text was updated successfully, but these errors were encountered: