From a2b623c752ceeaf414a46a4dfc2fad8ec1ecc386 Mon Sep 17 00:00:00 2001 From: "neeti%netscape.com" Date: Thu, 17 Oct 2002 03:23:33 +0000 Subject: [PATCH] fix for bug 161352 - URL: can't load local file with semicolon (;) in name,r=dougt@netscape.com,sr=darin@netscape.com,a=asa@mozilla.org git-svn-id: svn://10.0.0.236/trunk@132129 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/base/src/nsURLHelperMac.cpp | 4 ++++ mozilla/netwerk/base/src/nsURLHelperOS2.cpp | 4 ++++ mozilla/netwerk/base/src/nsURLHelperUnix.cpp | 4 ++++ mozilla/netwerk/base/src/nsURLHelperWin.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/mozilla/netwerk/base/src/nsURLHelperMac.cpp b/mozilla/netwerk/base/src/nsURLHelperMac.cpp index c14c1b5cc68..c716060b779 100644 --- a/mozilla/netwerk/base/src/nsURLHelperMac.cpp +++ b/mozilla/netwerk/base/src/nsURLHelperMac.cpp @@ -89,6 +89,10 @@ net_GetURLSpecFromFile(nsIFile *aFile, nsACString &aURL) // need encoding; use %2F which is a forward slash escPath.ReplaceSubstring(":", "%2F"); + // esc_Directory does not escape the semicolons, so if a filename + // contains semicolons we need to manually escape them. + escPath.ReplaceSubstring(";", "%3b"); + escPath.Insert(prefix, 0); // XXX this should be unnecessary diff --git a/mozilla/netwerk/base/src/nsURLHelperOS2.cpp b/mozilla/netwerk/base/src/nsURLHelperOS2.cpp index 38a65d66a66..b320a7a727c 100644 --- a/mozilla/netwerk/base/src/nsURLHelperOS2.cpp +++ b/mozilla/netwerk/base/src/nsURLHelperOS2.cpp @@ -78,6 +78,10 @@ net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result) else escPath.Assign(prefix + ePath); + // esc_Directory does not escape the semicolons, so if a filename + // contains semicolons we need to manually escape them. + escPath.ReplaceSubstring(";", "%3b"); + // XXX this should be unnecessary if (escPath[escPath.Length() - 1] != '/') { PRBool dir; diff --git a/mozilla/netwerk/base/src/nsURLHelperUnix.cpp b/mozilla/netwerk/base/src/nsURLHelperUnix.cpp index 9beb1bbe713..fd93eac5bdd 100644 --- a/mozilla/netwerk/base/src/nsURLHelperUnix.cpp +++ b/mozilla/netwerk/base/src/nsURLHelperUnix.cpp @@ -61,6 +61,10 @@ net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result) else escPath.Assign(prefix + ePath); + // esc_Directory does not escape the semicolons, so if a filename + // contains semicolons we need to manually escape them. + escPath.ReplaceSubstring(";", "%3b"); + // XXX this should be unnecessary if (escPath[escPath.Length() - 1] != '/') { PRBool dir; diff --git a/mozilla/netwerk/base/src/nsURLHelperWin.cpp b/mozilla/netwerk/base/src/nsURLHelperWin.cpp index 3adc5ed1151..a920bc14500 100644 --- a/mozilla/netwerk/base/src/nsURLHelperWin.cpp +++ b/mozilla/netwerk/base/src/nsURLHelperWin.cpp @@ -74,6 +74,10 @@ net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result) else escPath.Assign(prefix + ePath); + // esc_Directory does not escape the semicolons, so if a filename + // contains semicolons we need to manually escape them. + escPath.ReplaceSubstring(";", "%3b"); + // XXX this should be unnecessary if (escPath[escPath.Length() - 1] != '/') { PRBool dir;