Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1656)

Unified Diff: content/browser/webui/shared_resources_data_source.cc

Issue 2020393002: WebUI: only crash Chrome for invalid chrome:// URLs in debug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: debug-only Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/shared_resources_data_source.cc
diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc
index aa1289c279e19cd9f3786f02f63971e66a4ca971..7e5baf3337e384dbfac72140d9cfdeb299e0679c 100644
--- a/content/browser/webui/shared_resources_data_source.cc
+++ b/content/browser/webui/shared_resources_data_source.cc
@@ -112,12 +112,15 @@ std::string SharedResourcesDataSource::GetMimeType(
#if defined(OS_WIN)
base::FilePath file(base::UTF8ToWide(path));
- std::string extension = base::WideToUTF8(file.FinalExtension()).substr(1);
+ std::string extension = base::WideToUTF8(file.FinalExtension());
#else
base::FilePath file(path);
- std::string extension = file.FinalExtension().substr(1);
+ std::string extension = file.FinalExtension();
#endif
+ if (!extension.empty())
+ extension.erase(0, 1);
+
if (extension == "html")
return "text/html";
@@ -139,7 +142,7 @@ std::string SharedResourcesDataSource::GetMimeType(
if (extension == "woff2")
return "application/font-woff2";
- CHECK(false) << path;
+ NOTREACHED() << path;
return "text/plain";
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698