summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-14 13:57:44 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-14 13:57:44 +0000
commitce3eb7b6edbb9fc155a42fab697aeab36f8f40e8 (patch)
tree631f1be915501a55243f1aee3b338930c21609d2
parent5490bb983f7e4e111493e853a6091a4a516dd4d7 (diff)
downloadchromium_src-ce3eb7b6edbb9fc155a42fab697aeab36f8f40e8.zip
chromium_src-ce3eb7b6edbb9fc155a42fab697aeab36f8f40e8.tar.gz
chromium_src-ce3eb7b6edbb9fc155a42fab697aeab36f8f40e8.tar.bz2
Trailing slash in custom gallery URLs entered by users should not cause the links to break on the Extensions page.
BUG=55164 TEST=See bug. Review URL: http://codereview.chromium.org/3438001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59365 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/extensions/extension.cc2
-rw-r--r--chrome/common/extensions/extension.h5
2 files changed, 5 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 73ddccb..9e9eba1 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1633,6 +1633,8 @@ std::string Extension::ChromeStoreURL() {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kAppsGalleryURL);
+ if (EndsWith(gallery_prefix, "/", true))
+ gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1);
return gallery_prefix;
}
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 8f96120..5f127a4 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -233,11 +233,12 @@ class Extension {
static GURL GetBaseURLFromExtensionId(const std::string& extension_id);
// Returns whether the browser has apps enabled (either as the default or if
- // it was explictly turned on via a command line switch).
+ // it was explicitly turned on via a command line switch).
static bool AppsAreEnabled();
// Returns the url prefix for the extension/apps gallery. Can be set via the
- // --apps-gallery-url switch.
+ // --apps-gallery-url switch. The URL returned will not contain a trailing
+ // slash.
static std::string ChromeStoreURL();
// Initialize the extension from a parsed manifest.