This commit is contained in:
Johannes Rieken
2017-04-21 12:58:49 +02:00
parent 6097966099
commit 2ef2602cc8
2 changed files with 7 additions and 3 deletions

View File

@@ -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;
};
}

View File

@@ -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');
});