mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1040285 - Single Quotes should not be encoded in the path r=mcmanus,annevk
This commit is contained in:
parent
5dcb7c4b22
commit
5c759e8161
@ -1,7 +1,7 @@
|
||||
const testURLs = [
|
||||
["http://example.com/<", "http://example.com/%3C"],
|
||||
["http://example.com/>", "http://example.com/%3E"],
|
||||
["http://example.com/'", "http://example.com/%27"],
|
||||
["http://example.com/'", "http://example.com/'"],
|
||||
["http://example.com/\"", "http://example.com/%22"],
|
||||
["http://example.com/?<", "http://example.com/?%3C"],
|
||||
["http://example.com/?>", "http://example.com/?%3E"],
|
||||
|
@ -235,6 +235,14 @@ function test_escapeQueryBrackets()
|
||||
do_check_eq(url.spec, "http://[2001::1]/?a%5Bx%5D=1");
|
||||
}
|
||||
|
||||
function test_apostropheEncoding()
|
||||
{
|
||||
// For now, single quote is escaped everywhere _except_ the path.
|
||||
// This policy is controlled by the bitmask in nsEscape.cpp::EscapeChars[]
|
||||
var url = stringToURL("http://example.com/dir'/file'.ext'");
|
||||
do_check_eq(url.spec, "http://example.com/dir'/file'.ext'");
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
test_setEmptyPath();
|
||||
@ -244,4 +252,5 @@ function run_test()
|
||||
test_ipv6_fail();
|
||||
test_clearedSpec();
|
||||
test_escapeQueryBrackets();
|
||||
test_apostropheEncoding();
|
||||
}
|
||||
|
@ -163,14 +163,14 @@ exports.split = split;
|
||||
* Returns the file:// URI file path of the given local file path.
|
||||
*/
|
||||
// The case of %3b is designed to match Services.io, but fundamentally doesn't matter.
|
||||
let toFileURIExtraEncodings = {';': '%3b', '?': '%3F', "'": '%27', '#': '%23'};
|
||||
let toFileURIExtraEncodings = {';': '%3b', '?': '%3F', '#': '%23'};
|
||||
let toFileURI = function toFileURI(path) {
|
||||
let uri = encodeURI(this.normalize(path));
|
||||
|
||||
// add a prefix, and encodeURI doesn't escape a few characters that we do
|
||||
// want to escape, so fix that up
|
||||
let prefix = "file://";
|
||||
uri = prefix + uri.replace(/[;?'#]/g, match => toFileURIExtraEncodings[match]);
|
||||
uri = prefix + uri.replace(/[;?#]/g, match => toFileURIExtraEncodings[match]);
|
||||
|
||||
return uri;
|
||||
};
|
||||
|
@ -360,7 +360,7 @@ static const uint32_t EscapeChars[256] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
||||
0,1023, 0, 512,1023, 0,1023, 0,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./
|
||||
0,1023, 0, 512,1023, 0,1023, 112,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./
|
||||
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008,1008, 0,1008, 0, 768, // 3x 0123456789:;<=>?
|
||||
1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, // 4x @ABCDEFGHIJKLMNO
|
||||
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023, // 5x PQRSTUVWXYZ[\]^_
|
||||
|
Loading…
Reference in New Issue
Block a user