-
Notifications
You must be signed in to change notification settings - Fork 142
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
Downloaded images half broken in android #187
Comments
Could you send the code you're using? |
@RonRadtke To your question
We use AWS S3 timeout image here. We have set the 1 min. timeout. It works fine on IOS with the same connection. |
Thank you. I would assume that the content length is somehow off and there for the image is only stored half. |
I'm on the same team as @codingslash76, just wanted to offer some quick responses...
I know the feeling... we can't reproduce it on demand either. That's what is making this so frustrating. It doesn't appear to be related to the image storage source (AWS S3), as our other components (webapps, etc.) use the same API endpoints and load the images without issue 100% of the time. We typically test on a great connection as well, which makes a network hiccup unlikely at the frequency we're seeing the error.
No, it's not a chunked download. We're using AWS S3 for image storage, and AWS Presigned URLs with a 1-minute timeout for security. Here's the general workflow:
Most images load in under a second, so the timeout shouldn't be an issue (and since it's not a chunked download, it shouldn't matter anyway as the security will either pass or fail for the full download). This is also the only place we're seeing an issue, so I don't think the presigned URLs are the problem in general. Sorry to point the finger at your code, but we've got a pretty straightforward setup and are running out of ideas of what to test. 😬 Does it make a difference that the file can be displayed halfway? Meaning: the space required for the image at its full dimensions is blocked in the UI, it's just that only some part of the image actually loads. Is this different than if the image couldn't be displayed at all, or if the UI thought that the height of the image was only the visible/loaded section? For us, this issue is compounded because we cache the images for reuse... so if any image only downloads partially, it's reused everywhere in its partially-visible state, which isn't fixed until it ages off. One workaround that would be interesting (although we haven't figured out how to do it yet) is to be able to identify when an image hasn't fully downloaded, and retry it (or delete it locally so it's reloaded on the next try). If you have any thoughts on that, they'd certainly be appreciated, even though I know it's not your job. Thanks!! |
Guys, I am facing similar issue in IOS. Could any one was able to identify the root cause ? |
@codingslash76 you can reproduce this issue by killing your app before finishing the download. And you can track the download progress in below code block. |
export async function saveImageLocally(IMAGE_PATH) { |
We can fix this issue by first downloading the file in the temp location and after successfully downloading we can move the file to our desired location |
export async function saveImageLocally(IMAGE_PATH) { |
@Dawood-Shahid Thanks for your time here.
Is there a way to find out whether the image has been downloaded fully? @RonRadtke Did you find anything related to this? I am really stuck here. :( |
I'm experiencing this issue on iOS too (or at least one with the same symptoms). The problem in my case is related to the caching of the file, because the image appears correctly when I take the |
Update: the issue only occurs when using the "path" option. If I let it set the path file by default (set to ReactNativeBlobUtil_tmp${timestamp} as mentioned in the docs) and specify the extension instead it works!! I've tried to rummage through the code in fetch.js but I couldn't find anything obvious, I understand that a lot of this is happening on a native level right @RonRadtke? (I get a bit lost outside of javascript) |
Update 2: I've narrowed down to the way that the file path is created. If you set the file path as: path: ReactNativeBlobUtil.fs.dirs.DocumentDir + `/${customFileName}`, It doesn't work, whereas if you do this: path: ReactNativeBlobUtil.fs.dirs.DocumentDir + `${customFileName}`, It does work, and it calls it |
I also faced the same problem. For myself, I decided to use such a scheme, with publication (renaming) only if the file is exactly loaded.
Should work |
@vgsnv |
As mentioned in the issue.
joltup#130
We use react-native-blob-util to download images locally.
The text was updated successfully, but these errors were encountered: