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

Unified Diff: components/dom_distiller/core/page_features.cc

Issue 1680103003: Match the derived features to the training data set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style Created 4 years, 10 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 | components/dom_distiller/core/page_features_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/page_features.cc
diff --git a/components/dom_distiller/core/page_features.cc b/components/dom_distiller/core/page_features.cc
index 8e7405212844ab841bc35dc07089b2993c6a6d66..fffe52d0dba082b11d555683eb22aa3eed2edff5 100644
--- a/components/dom_distiller/core/page_features.cc
+++ b/components/dom_distiller/core/page_features.cc
@@ -24,7 +24,11 @@ std::string GetLastSegment(const std::string& path) {
// return re.search('[^/]*\/?$', path).group(0)
if (path.size() == 0)
return "";
- size_t start = path.rfind("/", path.size() - 1);
+ if (path.size() == 1) {
+ DCHECK(path[0] == '/');
+ return path;
+ }
+ size_t start = path.rfind("/", path.size() - 2);
return start == std::string::npos ? "" : path.substr(start + 1);
}
« no previous file with comments | « no previous file | components/dom_distiller/core/page_features_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698