提交 2ef2602c 编写于 作者: J Johannes Rieken

fix #24849

上级 60979660
......@@ -17,7 +17,7 @@ function encodeURIComponent2(str: string): string {
}
function encodeNoop(str: string): string {
return str;
return str.replace(/[#?]/, _encode);
}
......@@ -364,10 +364,10 @@ export default class URI {
while (true) {
let idx = path.indexOf(URI._slash, lastIdx);
if (idx === -1) {
parts.push(encoder(path.substring(lastIdx)).replace(/[#?]/, _encode));
parts.push(encoder(path.substring(lastIdx)));
break;
}
parts.push(encoder(path.substring(lastIdx, idx)).replace(/[#?]/, _encode), URI._slash);
parts.push(encoder(path.substring(lastIdx, idx)), URI._slash);
lastIdx = idx + 1;
};
}
......
......@@ -399,6 +399,10 @@ suite('URI', () => {
uri2 = URI.parse(uri.toString());
assert.equal(uri2.query, 'LinkId=518008&foö&ké¥=üü');
assert.equal(uri2.query, uri.query);
// #24849
uri = URI.parse('https://twitter.com/search?src=typd&q=%23tag');
assert.equal(uri.toString(true), 'https://twitter.com/search?src=typd&q=%23tag');
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册