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

Unified Diff: net/base/dir_header.html

Issue 196019: Properly concatenate URL components in directory listing. (Closed)
Patch Set: Created 11 years, 3 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: net/base/dir_header.html
diff --git a/net/base/dir_header.html b/net/base/dir_header.html
index 8e885e2a3f7503cd9b491d40c0d9094a41835bf5..550583175de10ec1bc4efe5ab73a3da6482659b2 100644
--- a/net/base/dir_header.html
+++ b/net/base/dir_header.html
@@ -7,12 +7,16 @@ function addRow(name, url, isdir, size, date_modified) {
if (name == ".")
return;
+ var root = "" + document.location;
wtc 2009/09/04 18:08:09 Just curious, why do we need the ""? Would "paren
eroman 2009/09/04 18:50:33 Instead of document.location, you can use document
+ if (root.substr(-1) !== "/")
+ root += "/";
+
var table = document.getElementById("table");
var row = document.createElement("tr");
var file_cell = document.createElement("td");
var link = document.createElement("a");
if (name == "..") {
- link.href = document.location + "/..";
+ link.href = root + "..";
link.innerText = document.getElementById("parentDirText").innerText;
size = "";
date_modified = "";
@@ -23,7 +27,7 @@ function addRow(name, url, isdir, size, date_modified) {
size = "";
}
link.innerText = name;
- link.href = document.location + "/" + url;
+ link.href = root + url;
}
file_cell.appendChild(link);
« 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