diff --git a/mozilla/modules/libjar/nsIJARURI.idl b/mozilla/modules/libjar/nsIJARURI.idl index a2a84a06dcd..ed78aff8da6 100644 --- a/mozilla/modules/libjar/nsIJARURI.idl +++ b/mozilla/modules/libjar/nsIJARURI.idl @@ -51,14 +51,14 @@ interface nsIJARURI : nsIURL { /** - * Returns the root URI (the one for the actual JAR file) for this JAR. - * eg http://www.big.com/blue.jar + * Returns the root URI (the one for the actual JAR file) for this JAR + * (e.g., http://www.big.com/blue.jar). */ attribute nsIURI JARFile; /** - * Returns the entry specified for this JAR URI. - * eg ocean.html + * Returns the entry specified for this JAR URI (e.g., "ocean.html"). This + * value may contain %-escaped byte sequences. */ attribute AUTF8String JAREntry; }; diff --git a/mozilla/modules/libjar/nsJARChannel.cpp b/mozilla/modules/libjar/nsJARChannel.cpp index f3b1c882c15..7bba2b99092 100644 --- a/mozilla/modules/libjar/nsJARChannel.cpp +++ b/mozilla/modules/libjar/nsJARChannel.cpp @@ -41,6 +41,7 @@ #include "nsMimeTypes.h" #include "nsNetUtil.h" #include "nsInt64.h" +#include "nsEscape.h" #include "nsIScriptSecurityManager.h" #include "nsIPrincipal.h" @@ -280,6 +281,12 @@ nsJARChannel::EnsureJarInput(PRBool blocking) rv = mJarURI->GetJAREntry(mJarEntry); if (NS_FAILED(rv)) return rv; + // The name of the JAR entry must not contains URL escaped characters: + // we're moving from URL domain to a filename domain here. nsStandardURL + // does basic escaping by default, which breaks reading zipped files which + // have e.g. spaces in their filenames. + NS_UnescapeURL(mJarEntry); + // try to get a nsIFile directly from the url, which will often succeed. { nsCOMPtr fileURL = do_QueryInterface(mJarBaseURI);