mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-16 21:36:27 +08:00
🐛 #1087 修复长链接转短链接接口中含有特殊字符导致微信access_token失效的问题
This commit is contained in:
@@ -145,6 +145,12 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
||||
|
||||
@Override
|
||||
public String shortUrl(String longUrl) throws WxErrorException {
|
||||
if (longUrl.contains("&access_token=")) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(-1)
|
||||
.errorMsg("要转换的网址中存在非法字符{&access_token=},会导致微信接口报错,属于微信bug,请调整地址,否则不建议使用此方法!")
|
||||
.build());
|
||||
}
|
||||
|
||||
JsonObject o = new JsonObject();
|
||||
o.addProperty("action", "long2short");
|
||||
o.addProperty("long_url", longUrl);
|
||||
|
||||
Reference in New Issue
Block a user