mirror of
https://gitee.com/openharmony/commonlibrary_ets_utils
synced 2025-02-09 03:28:17 +00:00
URL模块URLParams入参为%2B时get()出结果会错误显示为空格,实际应为+
https://gitee.com/openharmony/commonlibrary_ets_utils/issues/I9NMJJ Signed-off-by: zWX1234017 <zhaoduwei3@huawei.com>
This commit is contained in:
parent
9fb9818652
commit
f7f5cffdcc
@ -688,17 +688,6 @@ namespace OHOS::Url {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void IsPlusSign(size_t &strLastPos, const size_t &iteaor, std::string &buf, std::string &stringParm)
|
||||
{
|
||||
if (strLastPos < iteaor) {
|
||||
buf += stringParm.substr(strLastPos, iteaor - strLastPos + 1);
|
||||
} else {
|
||||
buf += "";
|
||||
}
|
||||
strLastPos = iteaor + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
static void IsEqualSign(size_t &strLastPos, const size_t &iteaor,
|
||||
std::string &buf, std::string &stringParm, std::vector<std::string> &seachParasVec)
|
||||
{
|
||||
@ -769,9 +758,6 @@ namespace OHOS::Url {
|
||||
isHasSpace = true;
|
||||
break;
|
||||
}
|
||||
case '+':
|
||||
IsPlusSign(strLastPos, iteaor, buf, stringParm);
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ function decodeSafelyInner(input: string): string {
|
||||
if (input === undefined || input === '') {
|
||||
return input;
|
||||
}
|
||||
input = input.replaceAll('+', ' ');
|
||||
const regex = /(%[a-f0-9A-F]{2})|[^%]+/g;
|
||||
let outStr = input.match(regex).map(part => {
|
||||
if (part.startsWith('%')) {
|
||||
@ -105,7 +106,7 @@ function decodeSafelyInner(input: string): string {
|
||||
}
|
||||
return part;
|
||||
}).join('');
|
||||
return outStr.replaceAll('+', ' ');
|
||||
return outStr;
|
||||
}
|
||||
|
||||
function customEncodeURIComponent(str: string | number): string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user