cordova-plugin-whitelist
cordova-plugin-whitelist copied to clipboard
On Android, whitelisting a path with wildcard does not work if a "/" is present
On Android platform, whitelisting everything under a path with a wildcard like https://example.com/foo/* does not seem to work properly: URLs like https://example.com/foo/bar are not considered whitelisted, and opened in the system browser.
Example:
This does NOT work as expected on Android
<allow-navigation href="https://example.com/app/*" />
This, instead, works (but might match also https://example.com/appointment):
<allow-navigation href="https://example.com/app*" />
On iOS, both work as expected.
I can reproduce this with the following versions:
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<engine name="ios" spec="^4.5.5" />
<engine name="android" spec="^7.1.2" />
Correction,
it works as expected, but on Android two entries have to be created for <allow-navigation />:
<allow-navigation href="https://example.com/app" />
<allow-navigation href="https://example.com/app/*" />
Otherwise the second one only won't match https://example.com/app, and the URL won't be whitelisted. On iOS, that is not necessary.
Feel free to close the issue. I am leaving it open because, while not a bug, I think this is surprising enough to deserve a mention in the documentation.
If this is different in iOS than on Android, I would indeeed consider this a bug. Thanks for reporting @lucaong!
Could you possibly go the extra mile and implement a quick reproduction app with cordova create, put it on GitHub and post the link here? This will make it much easier for someone in the future to reproduce and then fix this problem. That would be really nice 💝
Sure @janpio here is a repo that reproduces the issue, with instructions on how to run in the README file: https://github.com/lucaong/cordova-whitelist-issue-32
It is a fresh Cordova project, with only the cordova-plugin-whitelist installed.
We are archiving this repository following Apache Cordova's Deprecation Policy. We will not continue to work on this repository. Therefore all issues and pull requests are being closed. Thanks for your contribution.