You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2022/01/31 19:30:29 UTC

[GitHub] [cordova-plugin-file-transfer] ShaunBrassell edited a comment on issue #246: Downloaded file got in 0 Bytes

ShaunBrassell edited a comment on issue #246:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/246#issuecomment-1004675555


   I have the same issue on Android running Ionic. I have a podcast application that downloads episodes, and although most work well, some podcasts return a success, but have a file size of 0 bytes. Both links are downloadable in the browser though.
   
   Example of good URL: https://www.listennotes.com/e/p/54bb560d1a9e4ac1836662ee2c469030/
   
   Example of 0 byte issue: https://www.listennotes.com/e/p/8685f19b77874283a0b6e159eb7024ea/
   
   UPDATE - 31 Jan 2022
   
   I solved my issue on Android. I tested today on IOS, which worked fine, and since the above links work on a browser, I had a deeper look at Android. Both above links have redirects, which is handled fine by IOS. Turns out that Android java redirects using HttpURLConnection only work when the redirect protocol remains the same over each hop i.e. all http, or all https (by design, apparently for security reasons). In my case, the 'bad url' had multiple redirects, with a mix of protocols. So it stops when the protocol changes, and hence the file you download is the 302 redirect page where it changed, and hence you get a successful download, but with a file that is 0 bytes.
   
   My workaround is to add some code that manually follows the directs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org