dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

Getting gray rectangle on image after download but opening fine in browser

Open jaytiBansal opened this issue 4 years ago • 6 comments

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

Screenshot 2021-07-12 at 2 52 42 PM

jaytiBansal avatar Jul 12 '21 09:07 jaytiBansal

Can you share the code you're using to perform the download? Also, are you getting any error/output when it fails?

greg-db avatar Jul 14 '21 15:07 greg-db

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

dropbox.js.zip

jaytiBansal avatar Jul 30 '21 05:07 jaytiBansal

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?

greg-db avatar Jul 30 '21 16:07 greg-db

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.

jaytiBansal avatar Aug 03 '21 06:08 jaytiBansal

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

[ dropbox-20210907T051325Z-001.zip ]

jaytiBansal avatar Sep 07 '21 06:09 jaytiBansal

Thanks for the additional information. I'll follow up with you there.

greg-db avatar Sep 07 '21 15:09 greg-db