Skip to content

Commit

Permalink
fix(android): proper app url check for launching intents (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Mar 30, 2023
1 parent 88d0ded commit 302ba35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion android/capacitor/src/main/java/com/getcapacitor/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ public boolean launchIntent(Uri url) {
return false;
}

if (!url.toString().startsWith(appUrl) && !appAllowNavigationMask.matches(url.getHost())) {
Uri appUri = Uri.parse(appUrl);
if (
!(url.getHost().equals(appUri.getHost()) && url.getScheme().equals(appUri.getScheme())) &&
!appAllowNavigationMask.matches(url.getHost())
) {
try {
Intent openIntent = new Intent(Intent.ACTION_VIEW, url);
getContext().startActivity(openIntent);
Expand Down

0 comments on commit 302ba35

Please sign in to comment.