From ce3eb7b6edbb9fc155a42fab697aeab36f8f40e8 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Tue, 14 Sep 2010 13:57:44 +0000 Subject: 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 --- chrome/common/extensions/extension.cc | 2 ++ chrome/common/extensions/extension.h | 5 +++-- 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. -- cgit v1.1