зеркало из https://github.com/mozilla/gecko-dev.git
Bug 93141 - Expand `~` to home directory when fixing up file URIs r=mak
Differential Revision: https://phabricator.services.mozilla.com/D185562
This commit is contained in:
Родитель
29d6bd6af7
Коммит
11bd76e996
|
@ -925,8 +925,8 @@ function fileURIFixup(uriString) {
|
|||
path = uriString.replace(/\//g, "\\");
|
||||
}
|
||||
} else {
|
||||
// UNIX: Check if it starts with "/".
|
||||
attemptFixup = uriString.startsWith("/");
|
||||
// UNIX: Check if it starts with "/" or "~".
|
||||
attemptFixup = /^[~/]/.test(uriString);
|
||||
}
|
||||
if (attemptFixup) {
|
||||
try {
|
||||
|
|
|
@ -802,6 +802,18 @@ if (AppConstants.platform == "win") {
|
|||
affectedByDNSForSingleWordHosts: true,
|
||||
});
|
||||
} else {
|
||||
const homeDir = Services.dirsvc.get("Home", Ci.nsIFile).path;
|
||||
|
||||
testcases.push({
|
||||
input: "~",
|
||||
fixedURI: `file://${homeDir}`,
|
||||
protocolChange: true,
|
||||
});
|
||||
testcases.push({
|
||||
input: "~/foo",
|
||||
fixedURI: `file://${homeDir}/foo`,
|
||||
protocolChange: true,
|
||||
});
|
||||
testcases.push({
|
||||
input: "/some/file.txt",
|
||||
fixedURI: "file:///some/file.txt",
|
||||
|
|
Загрузка…
Ссылка в новой задаче