Skip to content

Commit 996bbcc

Browse files
Must URLEncode url passed to WebView loadUrl call since it will be decoded in the call. Otherwise e.g. query parameters in the intentstring that contain url-encoded ampersands and equalsigns will become corrupt.
1 parent d220fb3 commit 996bbcc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/android/nl/xservices/plugins/LaunchMyApp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.io.IOException;
1414
import java.io.StringWriter;
1515
import java.io.Writer;
16+
import java.net.URLEncoder;
1617
import java.util.Locale;
1718

1819
public class LaunchMyApp extends CordovaPlugin {
@@ -80,7 +81,7 @@ public void onNewIntent(Intent intent) {
8081
try {
8182
StringWriter writer = new StringWriter(intentString.length() * 2);
8283
escapeJavaStyleString(writer, intentString, true, false);
83-
webView.loadUrl("javascript:handleOpenURL('" + writer.toString() + "');");
84+
webView.loadUrl("javascript:handleOpenURL('" + URLEncoder.encode(writer.toString()) + "');");
8485
} catch (IOException ignore) {
8586
}
8687
}

0 commit comments

Comments
 (0)