diff --git a/netwerk/base/src/nsURLHelperMac.cpp b/netwerk/base/src/nsURLHelperMac.cpp index c14c1b5cc68e..c716060b779b 100644 --- a/netwerk/base/src/nsURLHelperMac.cpp +++ b/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/netwerk/base/src/nsURLHelperOS2.cpp b/netwerk/base/src/nsURLHelperOS2.cpp index 38a65d66a66f..b320a7a727cc 100644 --- a/netwerk/base/src/nsURLHelperOS2.cpp +++ b/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/netwerk/base/src/nsURLHelperUnix.cpp b/netwerk/base/src/nsURLHelperUnix.cpp index 9beb1bbe7132..fd93eac5bddf 100644 --- a/netwerk/base/src/nsURLHelperUnix.cpp +++ b/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/netwerk/base/src/nsURLHelperWin.cpp b/netwerk/base/src/nsURLHelperWin.cpp index 3adc5ed11516..a920bc145006 100644 --- a/netwerk/base/src/nsURLHelperWin.cpp +++ b/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;