Skip to content

Commit

Permalink
Remove some legacy versions of StartsWith and EndsWith.
Browse files Browse the repository at this point in the history
This just replaces
  true -> base::CompareCase::SENSITIVE
  false -> base::CompareCase::INSENSITIVE_ASCII

I checked the insensitive cases to make sure they're not doing anything suspicious. The old version is a sometimes-correct Unicode comparison so converting to INSENSTITIVE_ASCII isn't a no-op. However, generally the prefix/suffix checking is done against a hardcoded string so there were very few cases to actually look at.

extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc has a not-quite search-and-replace change where I changed the type of a class variable.

BUG=506255
TBR=jam

Reland of http://crrev.com/1239493005

Review URL: https://codereview.chromium.org/1233043003

Cr-Commit-Position: refs/heads/master@{#339071}
  • Loading branch information
brettw authored and Commit bot committed Jul 16, 2015
1 parent 7befa9c commit a7ff1b2
Show file tree
Hide file tree
Showing 88 changed files with 326 additions and 225 deletions.
6 changes: 3 additions & 3 deletions base/android/library_loader/library_prefetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool IsReadableAndPrivate(const base::debug::MappedMemoryRegion& region) {

bool PathMatchesSuffix(const std::string& path) {
for (size_t i = 0; i < arraysize(kSuffixesToMatch); i++) {
if (EndsWith(path, kSuffixesToMatch[i], true)) {
if (EndsWith(path, kSuffixesToMatch[i], CompareCase::SENSITIVE)) {
return true;
}
}
Expand Down Expand Up @@ -82,14 +82,14 @@ void NativeLibraryPrefetcher::FilterLibchromeRangesOnlyIfPossible(
std::vector<AddressRange>* ranges) {
bool has_libchrome_region = false;
for (const base::debug::MappedMemoryRegion& region : regions) {
if (EndsWith(region.path, kLibchromeSuffix, true)) {
if (EndsWith(region.path, kLibchromeSuffix, CompareCase::SENSITIVE)) {
has_libchrome_region = true;
break;
}
}
for (const base::debug::MappedMemoryRegion& region : regions) {
if (has_libchrome_region &&
!EndsWith(region.path, kLibchromeSuffix, true)) {
!EndsWith(region.path, kLibchromeSuffix, CompareCase::SENSITIVE)) {
continue;
}
ranges->push_back(std::make_pair(region.start, region.end));
Expand Down
13 changes: 0 additions & 13 deletions base/strings/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,19 +381,6 @@ inline bool StartsWithASCII(const std::string& str,
case_sensitive ? CompareCase::SENSITIVE
: CompareCase::INSENSITIVE_ASCII);
}
BASE_EXPORT bool StartsWith(const string16& str,
const string16& search,
bool case_sensitive);
inline bool EndsWith(const std::string& str,
const std::string& search,
bool case_sensitive) {
return EndsWith(StringPiece(str), StringPiece(search),
case_sensitive ? CompareCase::SENSITIVE
: CompareCase::INSENSITIVE_ASCII);
}
BASE_EXPORT bool EndsWith(const string16& str,
const string16& search,
bool case_sensitive);

// Determines the type of ASCII character, independent of locale (the C
// library versions will change based on locale).
Expand Down
114 changes: 69 additions & 45 deletions base/strings/string_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -706,59 +706,83 @@ TEST(StringUtilTest, JoinString16) {
}

TEST(StringUtilTest, StartsWith) {
EXPECT_TRUE(StartsWithASCII("javascript:url", "javascript", true));
EXPECT_FALSE(StartsWithASCII("JavaScript:url", "javascript", true));
EXPECT_TRUE(StartsWithASCII("javascript:url", "javascript", false));
EXPECT_TRUE(StartsWithASCII("JavaScript:url", "javascript", false));
EXPECT_FALSE(StartsWithASCII("java", "javascript", true));
EXPECT_FALSE(StartsWithASCII("java", "javascript", false));
EXPECT_FALSE(StartsWithASCII(std::string(), "javascript", false));
EXPECT_FALSE(StartsWithASCII(std::string(), "javascript", true));
EXPECT_TRUE(StartsWithASCII("java", std::string(), false));
EXPECT_TRUE(StartsWithASCII("java", std::string(), true));
EXPECT_TRUE(StartsWith("javascript:url", "javascript",
base::CompareCase::SENSITIVE));
EXPECT_FALSE(StartsWith("JavaScript:url", "javascript",
base::CompareCase::SENSITIVE));
EXPECT_TRUE(StartsWith("javascript:url", "javascript",
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(StartsWith("JavaScript:url", "javascript",
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith("java", "javascript", base::CompareCase::SENSITIVE));
EXPECT_FALSE(StartsWith("java", "javascript",
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith(std::string(), "javascript",
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith(std::string(), "javascript",
base::CompareCase::SENSITIVE));
EXPECT_TRUE(StartsWith("java", std::string(),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(StartsWith("java", std::string(), base::CompareCase::SENSITIVE));

EXPECT_TRUE(StartsWith(ASCIIToUTF16("javascript:url"),
ASCIIToUTF16("javascript"), true));
ASCIIToUTF16("javascript"),
base::CompareCase::SENSITIVE));
EXPECT_FALSE(StartsWith(ASCIIToUTF16("JavaScript:url"),
ASCIIToUTF16("javascript"), true));
ASCIIToUTF16("javascript"),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("javascript:url"),
ASCIIToUTF16("javascript"), false));
ASCIIToUTF16("javascript"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("JavaScript:url"),
ASCIIToUTF16("javascript"), false));
EXPECT_FALSE(StartsWith(ASCIIToUTF16("java"),
ASCIIToUTF16("javascript"), true));
EXPECT_FALSE(StartsWith(ASCIIToUTF16("java"),
ASCIIToUTF16("javascript"), false));
EXPECT_FALSE(StartsWith(string16(), ASCIIToUTF16("javascript"), false));
EXPECT_FALSE(StartsWith(string16(), ASCIIToUTF16("javascript"), true));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("java"), string16(), false));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("java"), string16(), true));
ASCIIToUTF16("javascript"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith(ASCIIToUTF16("java"), ASCIIToUTF16("javascript"),
base::CompareCase::SENSITIVE));
EXPECT_FALSE(StartsWith(ASCIIToUTF16("java"), ASCIIToUTF16("javascript"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith(string16(), ASCIIToUTF16("javascript"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(StartsWith(string16(), ASCIIToUTF16("javascript"),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("java"), string16(),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(StartsWith(ASCIIToUTF16("java"), string16(),
base::CompareCase::SENSITIVE));
}

TEST(StringUtilTest, EndsWith) {
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"),
ASCIIToUTF16(".plugin"), true));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.Plugin"),
ASCIIToUTF16(".plugin"), true));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"),
ASCIIToUTF16(".plugin"), false));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.Plugin"),
ASCIIToUTF16(".plugin"), false));
EXPECT_FALSE(EndsWith(ASCIIToUTF16(".plug"), ASCIIToUTF16(".plugin"), true));
EXPECT_FALSE(EndsWith(ASCIIToUTF16(".plug"), ASCIIToUTF16(".plugin"), false));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.plugin Bar"),
ASCIIToUTF16(".plugin"), true));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.plugin Bar"),
ASCIIToUTF16(".plugin"), false));
EXPECT_FALSE(EndsWith(string16(), ASCIIToUTF16(".plugin"), false));
EXPECT_FALSE(EndsWith(string16(), ASCIIToUTF16(".plugin"), true));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), string16(), false));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), string16(), true));
EXPECT_TRUE(EndsWith(ASCIIToUTF16(".plugin"),
ASCIIToUTF16(".plugin"), false));
EXPECT_TRUE(EndsWith(ASCIIToUTF16(".plugin"), ASCIIToUTF16(".plugin"), true));
EXPECT_TRUE(EndsWith(string16(), string16(), false));
EXPECT_TRUE(EndsWith(string16(), string16(), true));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.Plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.Plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(EndsWith(ASCIIToUTF16(".plug"), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_FALSE(EndsWith(ASCIIToUTF16(".plug"), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.plugin Bar"), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_FALSE(EndsWith(ASCIIToUTF16("Foo.plugin Bar"), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(EndsWith(string16(), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_FALSE(EndsWith(string16(), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), string16(),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(EndsWith(ASCIIToUTF16("Foo.plugin"), string16(),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(EndsWith(ASCIIToUTF16(".plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(EndsWith(ASCIIToUTF16(".plugin"), ASCIIToUTF16(".plugin"),
base::CompareCase::SENSITIVE));
EXPECT_TRUE(
EndsWith(string16(), string16(), base::CompareCase::INSENSITIVE_ASCII));
EXPECT_TRUE(EndsWith(string16(), string16(), base::CompareCase::SENSITIVE));
}

TEST(StringUtilTest, GetStringFWithOffsets) {
Expand Down
2 changes: 1 addition & 1 deletion base/test/test_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void TestSuite::Initialize() {
i18n::SetICUDefaultLocale("en_US");
#else
std::string default_locale(uloc_getDefault());
if (EndsWith(default_locale, "POSIX", false))
if (EndsWith(default_locale, "POSIX", CompareCase::INSENSITIVE_ASCII))
i18n::SetICUDefaultLocale("en_US");
#endif
#endif
Expand Down
3 changes: 2 additions & 1 deletion chrome/app/delay_load_hook_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ FARPROC OnPreLoadLibrary(DelayLoadInfo* info) {
// and bind to the real DLL.
std::string dll_name(info->szDll);
const char kDelaySuffix[] = "-delay.dll";
if (base::EndsWith(dll_name, kDelaySuffix, false)) {
if (base::EndsWith(dll_name, kDelaySuffix,
base::CompareCase::INSENSITIVE_ASCII)) {
// Trim the "-delay.dll" suffix from the string.
dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1));
dll_name.append(".dll");
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/banners/app_banner_data_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) {
// the src extension, and allow the icon if the extension ends with png.
if (!base::EqualsASCII(icon.type.string(), "image/png") &&
!(icon.type.is_null() &&
base::EndsWith(icon.src.ExtractFileName(), kPngExtension, false)))
base::EndsWith(icon.src.ExtractFileName(), kPngExtension,
base::CompareCase::INSENSITIVE_ASCII)))
continue;

for (const auto& size : icon.sizes) {
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/chromeos/extensions/wallpaper_private_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,8 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList() {
current = files.Next()) {
std::string file_name = current.BaseName().RemoveExtension().value();
// Do not add file name of small resolution wallpaper to the list.
if (!base::EndsWith(file_name, wallpaper::kSmallWallpaperSuffix, true))
if (!base::EndsWith(file_name, wallpaper::kSmallWallpaperSuffix,
base::CompareCase::SENSITIVE))
file_list.push_back(current.BaseName().value());
}
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/chromeos/policy/device_local_account.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ bool IsDeviceLocalAccountUser(const std::string& user_id,
if (user_id == chromeos::login::kGuestUserName)
return false;
const std::string domain = gaia::ExtractDomainName(user_id);
if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix, true))
if (!base::EndsWith(domain, kDeviceLocalAccountDomainSuffix,
base::CompareCase::SENSITIVE))
return false;

const std::string domain_prefix = domain.substr(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ TEST_F(CldComponentInstallerTest, GetInstalledPath) {
const base::FilePath base_dir;
const base::FilePath result =
CldComponentInstallerTraits::GetInstalledPath(base_dir);
ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true));
ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName,
base::CompareCase::SENSITIVE));
}

TEST_F(CldComponentInstallerTest, GetBaseDirectory) {
Expand All @@ -127,8 +128,10 @@ TEST_F(CldComponentInstallerTest, ComponentReady) {
traits_.ComponentReady(version, install_dir, manifest.Pass());
base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile();
ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(),
install_dir.AsUTF16Unsafe(), true));
ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, true));
install_dir.AsUTF16Unsafe(),
base::CompareCase::SENSITIVE));
ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName,
base::CompareCase::SENSITIVE));
}

} // namespace component_updater
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ class DelayLoadStartAndExecuteJavascript
const GURL& url,
ui::PageTransition transition_type) override {
if (script_was_executed_ &&
base::EndsWith(url.spec(), until_url_suffix_, true)) {
base::EndsWith(url.spec(), until_url_suffix_,
base::CompareCase::SENSITIVE)) {
content::WebContentsObserver::Observe(NULL);
test_navigation_listener_->ResumeAll();
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/extensions/default_apps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ bool IsLocaleSupported() {
const std::string& locale = g_browser_process->GetApplicationLocale();
static const char* const unsupported_locales[] = {"CN", "TR", "IR"};
for (size_t i = 0; i < arraysize(unsupported_locales); ++i) {
if (base::EndsWith(locale, unsupported_locales[i], false)) {
if (base::EndsWith(locale, unsupported_locales[i],
base::CompareCase::INSENSITIVE_ASCII)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/updater/local_extension_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void LocalExtensionCache::BackendCheckCacheContentsInternal(
std::string version;
std::string expected_hash;
if (base::EndsWith(basename, kCRXFileExtension,
false /* case-sensitive */)) {
base::CompareCase::INSENSITIVE_ASCII)) {
size_t n = basename.find('-');
if (n != std::string::npos && n + 1 < basename.size() - 4) {
id = basename.substr(0, n);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/metrics/chromeos_metrics_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ EnrollmentStatus GetEnrollmentStatus() {
return NON_MANAGED;

std::string domain = connector->GetEnterpriseDomain();
if (base::EndsWith(domain, kEduDomain, false /* case insensitive */))
if (base::EndsWith(domain, kEduDomain, base::CompareCase::INSENSITIVE_ASCII))
return MANAGED_EDU;

return MANAGED_NON_EDU;
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/net/pref_proxy_config_tracker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace {
// Determine if |proxy| is of the form "*.googlezip.net".
bool IsGooglezipDataReductionProxy(const net::ProxyServer& proxy) {
return proxy.is_valid() && !proxy.is_direct() &&
base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true);
base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net",
base::CompareCase::SENSITIVE);
}

// Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ bool ContainsDataReductionProxyDefaultHostSuffix(
for (const net::ProxyServer& proxy : proxy_list.GetAll()) {
if (proxy.is_valid() && !proxy.is_direct() &&
base::EndsWith(proxy.host_port_pair().host(),
kDataReductionProxyDefaultHostSuffix, true)) {
kDataReductionProxyDefaultHostSuffix,
base::CompareCase::SENSITIVE)) {
return true;
}
}
Expand Down
26 changes: 17 additions & 9 deletions chrome/browser/safe_browsing/safe_browsing_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,8 @@ void SafeBrowsingDatabaseNew::RecordFileSizeHistogram(

// Default to logging DB sizes unless |file_path| points at PrefixSet storage.
std::string histogram_name("SB2.DatabaseSizeKilobytes");
if (base::EndsWith(filename, kPrefixSetFileSuffix, true)) {
if (base::EndsWith(filename, kPrefixSetFileSuffix,
base::CompareCase::SENSITIVE)) {
histogram_name = "SB2.PrefixSetSizeKilobytes";
// Clear the PrefixSet suffix to have the histogram suffix selector below
// work the same for PrefixSet-based storage as it does for simple safe
Expand All @@ -1805,21 +1806,28 @@ void SafeBrowsingDatabaseNew::RecordFileSizeHistogram(

// Changes to histogram suffixes below need to be mirrored in the
// SafeBrowsingLists suffix enum in histograms.xml.
if (base::EndsWith(filename, kBrowseDBFile, true))
if (base::EndsWith(filename, kBrowseDBFile, base::CompareCase::SENSITIVE))
histogram_name.append(".Browse");
else if (base::EndsWith(filename, kDownloadDBFile, true))
else if (base::EndsWith(filename, kDownloadDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".Download");
else if (base::EndsWith(filename, kCsdWhitelistDBFile, true))
else if (base::EndsWith(filename, kCsdWhitelistDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".CsdWhitelist");
else if (base::EndsWith(filename, kDownloadWhitelistDBFile, true))
else if (base::EndsWith(filename, kDownloadWhitelistDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".DownloadWhitelist");
else if (base::EndsWith(filename, kInclusionWhitelistDBFile, true))
else if (base::EndsWith(filename, kInclusionWhitelistDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".InclusionWhitelist");
else if (base::EndsWith(filename, kExtensionBlacklistDBFile, true))
else if (base::EndsWith(filename, kExtensionBlacklistDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".ExtensionBlacklist");
else if (base::EndsWith(filename, kIPBlacklistDBFile, true))
else if (base::EndsWith(filename, kIPBlacklistDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".IPBlacklist");
else if (base::EndsWith(filename, kUnwantedSoftwareDBFile, true))
else if (base::EndsWith(filename, kUnwantedSoftwareDBFile,
base::CompareCase::SENSITIVE))
histogram_name.append(".UnwantedSoftware");
else
NOTREACHED(); // Add support for new lists above.
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/search/iframe_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ IframeSource::~IframeSource() {
std::string IframeSource::GetMimeType(
const std::string& path_and_query) const {
std::string path(GURL("chrome-search://host/" + path_and_query).path());
if (base::EndsWith(path, ".js", false))
if (base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII))
return "application/javascript";
if (base::EndsWith(path, ".png", false))
if (base::EndsWith(path, ".png", base::CompareCase::INSENSITIVE_ASCII))
return "image/png";
if (base::EndsWith(path, ".css", false))
if (base::EndsWith(path, ".css", base::CompareCase::INSENSITIVE_ASCII))
return "text/css";
if (base::EndsWith(path, ".html", false))
if (base::EndsWith(path, ".html", base::CompareCase::INSENSITIVE_ASCII))
return "text/html";
return std::string();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GURL GetNormalizedURL(const GURL& url) {
replacements.SetHostStr(base::StringPiece(host).substr(www.size()));
// Strip trailing slash (if any).
const std::string path(url.path());
if (base::EndsWith(path, "/", true))
if (base::EndsWith(path, "/", base::CompareCase::SENSITIVE))
replacements.SetPathStr(base::StringPiece(path).substr(0, path.size() - 1));
return url.ReplaceComponents(replacements);
}
Expand Down
Loading

0 comments on commit a7ff1b2

Please sign in to comment.