dropbox-sdk-js
dropbox-sdk-js copied to clipboard
Getting gray rectangle on image after download but opening fine in browser
When we are downloading image with the dropbox npm package, some images are getting gray rectangle on the image but if we try to hit the dropbox image link in the browser, it opens fine.
This issue is very random and happening for few images only.
Attached the screenshot of image.
Versions- ^9.6.0 nodejs - 10.4
dropbox link - https://www.dropbox.com/s/8cofqi71n7vbuzt/121246522600%20C717%20%281%29.jpg?dl=0
Can you share the code you're using to perform the download? Also, are you getting any error/output when it fails?
Hi,
Sorry for late reply. Attached is the code we are using for downloading images asynchronously. So we have a csv as input where multiple dropbox links are available in each row (there could be same image link available in multiple rows). We are processing all rows parallely and invoking this code for download.
Thanks, Jayti
Thanks! So I see you're using the sharingGetSharedLinkFile method to get the contents of a file from a shared link. I just gave this a try myself, plugging in my own test access token and using the sample shared link you supplied, and saving the resulting file to the filesystem. I ran it several times, but I never got an incomplete or corrupted download like you saw.
Is there anything in your environment that may be interrupting the download? Are you getting any error/output in the console?
This is happening when we are hitting for the same image download multiple times asynchronously. For time being, I made a code fix to group all the images and download only once.. But I am not confident as this is the only reason behind cropped images. I will keep posting my finding.
We are able to reproduce this issue by downloading few images to local drive. code is attached. Seems like dropbox is returning image binary data in different chunks and not all are merged together before downloading . May be we can try to fix this by supporting streams instead of buffer. https://github.com/dropbox/dropbox-sdk-js/issues/499
Thanks for the additional information. I'll follow up with you there.