Skip to content

Commit

Permalink
Merge pull request #239 from LandChanning/master
Browse files Browse the repository at this point in the history
处理 BridgeHelper.shouldOverrideUrlLoading(String url) 方法 URLDecoder.decode 可能的崩溃
  • Loading branch information
uknownothingsnow authored Mar 23, 2021
2 parents 3621bd6 + da4e908 commit 9fef0b6
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ private void webViewLoadLocalJs() {

public boolean shouldOverrideUrlLoading(String url) {
try {
url = URLDecoder.decode(url, "UTF-8");
// decode 之前,处理 % 和 +
String replacedUrl = url.replaceAll("%(?![0-9a-fA-F]{2})", "%25").replaceAll("\\+", "%2B");
url = URLDecoder.decode(replacedUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
Log.w(TAG, e);
}
Expand Down

0 comments on commit 9fef0b6

Please sign in to comment.