Followup patch to deal with escaped characters, bug 367428 r=biesi

This commit is contained in:
benjamin%smedbergs.us 2007-02-26 16:57:48 +00:00
Родитель 0eba768f5a
Коммит d7b8769ad1
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -51,6 +51,7 @@
#include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsURLHelper.h" #include "nsURLHelper.h"
#include "nsEscape.h"
static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID); static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID);
@ -331,8 +332,11 @@ nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
url->GetFilePath(filepath); url->GetFilePath(filepath);
// Don't misinterpret the filepath as an absolute URI. // Don't misinterpret the filepath as an absolute URI.
if (filepath.FindChar(':') != -1 || if (filepath.FindChar(':') != -1)
filepath.FindChar('\\') != -1) return NS_ERROR_MALFORMED_URI;
NS_UnescapeURL(filepath);
if (filepath.FindChar('\\') != -1)
return NS_ERROR_MALFORMED_URI; return NS_ERROR_MALFORMED_URI;
const char *p = path.get() + 1; // path always starts with a slash const char *p = path.get() + 1; // path always starts with a slash

Просмотреть файл

@ -11,6 +11,8 @@ const specs = [
"resource:///file:///", "resource:///file:///",
"resource:///..\\", "resource:///..\\",
"resource:///..\\..\\", "resource:///..\\..\\",
"resource:///..%5C",
"resource:///..%5c"
]; ];
function check_for_exception(spec) function check_for_exception(spec)