Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urlDecode导致query参数缺失 #175

Open
LeeKM opened this issue Apr 26, 2019 · 1 comment
Open

urlDecode导致query参数缺失 #175

LeeKM opened this issue Apr 26, 2019 · 1 comment

Comments

@LeeKM
Copy link

LeeKM commented Apr 26, 2019

相关代码: BridgeWebViewClient

当页面打开如下链接时候:

alipays://platformapi/startApp?appId=20000125&orderSuffix=h5_route_token%3d%22RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13%22%26is_h5_route%3d%22true%22

此时query参数为:

appId = 20000125
orderSuffix = h5_route_token%3d%22RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13%22%26is_h5_route%3d%22true%22

容器拦截并直接deocde得到:

alipays://platformapi/startApp?appId=20000125&orderSuffix=h5_route_token="RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13"&is_h5_route="true"

此时query参数变成:

appId = 20000125
orderSuffix = h5_route_token="RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13"
is_h5_route = true

发生参数异常

@LeeKM
Copy link
Author

LeeKM commented Oct 8, 2019

相关代码: BridgeWebViewClient

当页面打开如下链接时候:

alipays://platformapi/startApp?appId=20000125&orderSuffix=h5_route_token%3d%22RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13%22%26is_h5_route%3d%22true%22

此时query参数为:

appId = 20000125
orderSuffix = h5_route_token%3d%22RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13%22%26is_h5_route%3d%22true%22

容器拦截并直接deocde得到:

alipays://platformapi/startApp?appId=20000125&orderSuffix=h5_route_token="RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13"&is_h5_route="true"

此时query参数变成:

appId = 20000125
orderSuffix = h5_route_token="RZ13gRJLQjVvGhfoBvMptJq4tz8Q2imobilecashierRZ13"
is_h5_route = true

发生参数异常

解决办法:

  1. 不要直接使用BridgeWebView,继承并覆盖BridgeWebView#generateBridgeWebViewClient方法
  2. 继承BridgeWebViewClient并覆盖BridgeWebViewClient#shouldOverrideUrlLoading(WebView, String)BridgeWebViewClient#shouldOverrideUrlLoading(WebView, WebResourceRequest),优先使用支付宝SDK进行拦截

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant