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

Unified Diff: src/url_canon_path.cc

Issue 10386035: Fix path component length for zero-length paths canonicalized to '/'. (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: Created 8 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 | src/url_canon_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_canon_path.cc
===================================================================
--- src/url_canon_path.cc (revision 173)
+++ src/url_canon_path.cc (working copy)
@@ -325,9 +325,8 @@
CanonOutput* output,
url_parse::Component* out_path) {
bool success = true;
+ out_path->begin = output->length();
if (path.len > 0) {
- out_path->begin = output->length();
-
// Write out an initial slash if the input has none. If we just parse a URL
// and then canonicalize it, it will of course have a slash already. This
// check is for the replacement and relative URL resolving cases of file
@@ -336,12 +335,11 @@
output->push_back('/');
success = DoPartialPath<CHAR, UCHAR>(spec, path, out_path->begin, output);
- out_path->len = output->length() - out_path->begin;
} else {
// No input, canonical path is a slash.
output->push_back('/');
- *out_path = url_parse::Component();
}
+ out_path->len = output->length() - out_path->begin;
return success;
}
« no previous file with comments | « no previous file | src/url_canon_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698