apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
595 stars 888 forks source link

images failing from whitelisted urls #334

Open CodeWithOz opened 2 years ago

CodeWithOz commented 2 years ago

Bug Report

Problem

I get a 401 error when I try to download images using the file-transfer plugin. My server doesn't return a 401 status at all, so it's not an issue with authentication on my server. I tracked down the code that's generating the 401 status to this line of code that sends the 401 status if the url is not in the allow list for the app. The problem is that the url should match because its base is in the allow list. I have set the allow list to allow both full and wildcard matching of the base url, yet this problem continues to happen. These are my access tags for the base url:

    <access origin="https://cloud.dev.textras.com/*" />
    <access origin="https://*.dev.textras.com/*" />
    <access origin="https://*.textras.com/*" />

And an example of an image url that's not getting downloaded is https://cloud.dev.textras.com/v1/media/round?r=32&q=100&f=images/6151be6d02dbc700142308af/thumbnail.jpeg. The image loads correctly in an img tag and in the browser.

What is expected to happen?

The image should be downloaded without problems.

What does actually happen?

Please see the problem description above

Information

Please see the problem description above

Command or Code

N/A

Environment, Platform, Device

From Android 8 to latest Android

Version information

Checklist