зеркало из https://github.com/mozilla/gecko-dev.git
fixes bug 289851 "jar: protocol does not handle file names with embedded spaces" patch by Simo Melenius (simo.melenius@citec.fi), r=biesi, sr=darin
This commit is contained in:
Родитель
a8cdc34752
Коммит
e33d64b3dc
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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<nsIFileURL> fileURL = do_QueryInterface(mJarBaseURI);
|
||||
|
|
Загрузка…
Ссылка в новой задаче