Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add filename to path #1078

Merged
merged 1 commit into from Mar 17, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

add filename to URL

  • Loading branch information
pahwaranger committed Mar 16, 2017
commit 275766705585147c923a556de80b7e2fc313f4c2
@@ -107,7 +107,7 @@ function Server (torrent, opts) {
return serveIndexPage()
}

var index = Number(pathname.slice(1))
var index = Number(pathname.split('/')[1])
if (Number.isNaN(index) || index >= torrent.files.length) {
return serve404Page()
}
@@ -121,7 +121,7 @@ function Server (torrent, opts) {
res.setHeader('Content-Type', 'text/html')

var listHtml = torrent.files.map(function (file, i) {
return '<li><a download="' + file.name + '" href="/' + i + '">' + file.path + '</a> ' +
return '<li><a download="' + file.name + '" href="/' + i + '/' + file.name + '">' + file.path + '</a> ' +
'(' + file.length + ' bytes)</li>'
}).join('<br>')

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.