Skip to content

Commit

Permalink
urlencode the folder name in the title
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 21, 2014
1 parent 3ef0174 commit f961d4a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions st.js
Expand Up @@ -439,12 +439,18 @@ Mount.prototype.streamFile = function (p, fd, stat, etag, req, res, end) {
Mount.prototype._loadIndex = function (p, cb) {
// truncate off the first bits
var url = p.substr(this.path.length).replace(/\\/g, '/')
var t = url
.replace(/"/g, '"')
.replace(/>/g, '<')
.replace(/</g, '&gt;')
.replace(/'/g, '&#39;')

var str =
'<!doctype html>' +
'<html>' +
'<head><title>Index of ' + url + '</title></head>' +
'<head><title>Index of ' + t + '</title></head>' +
'<body>' +
'<h1>Index of ' + url + '</h1>' +
'<h1>Index of ' + t + '</h1>' +
'<hr><pre><a href="../">../</a>\n'

this.cache.readdir.get(p, function (er, data) {
Expand Down

0 comments on commit f961d4a

Please sign in to comment.