| Index: chrome/common/extensions/extension.cc
|
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
|
| index a6d2159d418855e923f02a14073f254d616bc5ab..a12fce851e33bf3202e7ab6cf3405ea707729420 100644
|
| --- a/chrome/common/extensions/extension.cc
|
| +++ b/chrome/common/extensions/extension.cc
|
| @@ -2295,16 +2295,27 @@ FileBrowserHandler* Extension::LoadFileBrowserHandler(
|
| return NULL;
|
| }
|
| StringToLowerASCII(&filter);
|
| - URLPattern pattern(URLPattern::SCHEME_FILESYSTEM);
|
| + if (!StartsWithASCII(filter,
|
| + std::string(chrome::kFileSystemScheme) + ':',
|
| + true)) {
|
| + *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
|
| + errors::kInvalidURLPatternError, filter);
|
| + return NULL;
|
| + }
|
| + // The user inputs filesystem:*; we don't actually implement scheme
|
| + // wildcards in URLPattern, so transform to what will match correctly.
|
| + filter.replace(0, 11, "chrome-extension://*/");
|
| + URLPattern pattern(URLPattern::SCHEME_EXTENSION);
|
| + pattern.SetMatchNestedURLPath(true);
|
| if (pattern.Parse(filter) != URLPattern::PARSE_SUCCESS) {
|
| *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
|
| errors::kInvalidURLPatternError, filter);
|
| return NULL;
|
| }
|
| std::string path = pattern.path();
|
| - bool allowed = path == "*" || path == "*.*" ||
|
| - (path.compare(0, 2, "*.") == 0 &&
|
| - path.find_first_of('*', 2) == std::string::npos);
|
| + bool allowed = path == "/*" || path == "/*.*" ||
|
| + (path.compare(0, 3, "/*.") == 0 &&
|
| + path.find_first_of('*', 3) == std::string::npos);
|
| if (!allowed) {
|
| *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
|
| errors::kInvalidURLPatternError, filter);
|
|
|