fix: 支付宝表单使用原始值,浏览器自动处理URL编码
修复 double-encoding 问题:表单 hidden input 不应预先 URL 编码, 浏览器提交时会自动编码,预编码会导致二次编码(如空格变 %2520)
This commit is contained in:
@@ -170,18 +170,17 @@ fn build_alipay_form_html(
|
||||
|
||||
let sign = rsa2_sign(&sign_source, &config.private_key)?;
|
||||
|
||||
// 生成自动提交的表单 HTML
|
||||
// 生成自动提交的表单 HTML(使用原始值,浏览器会自动 URL 编码)
|
||||
let mut form_fields = String::new();
|
||||
for (k, v) in ¶ms {
|
||||
form_fields.push_str(&format!(
|
||||
r#"<input type="hidden" name="{}" value="{}" />"#,
|
||||
urlencoding(k),
|
||||
urlencoding(v)
|
||||
k, v
|
||||
));
|
||||
}
|
||||
form_fields.push_str(&format!(
|
||||
r#"<input type="hidden" name="sign" value="{}" />"#,
|
||||
urlencoding(&sign)
|
||||
&sign
|
||||
));
|
||||
|
||||
let html = format!(
|
||||
|
||||
Reference in New Issue
Block a user