Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upadd filename to path #1078
Merged
add filename to path #1078
Conversation
This comment has been minimized.
This comment has been minimized.
|
Sure, why not. |
|
LGTM |
lib/server.js
Outdated
| @@ -107,7 +107,7 @@ function Server (torrent, opts) { | |||
| return serveIndexPage() | |||
| } | |||
|
|
|||
| var index = Number(pathname.slice(1)) | |||
| var index = Number(pathname.split('/')[0]) | |||
This comment has been minimized.
This comment has been minimized.
feross
Mar 16, 2017
•
Member
Did you test this and verify it works? This looks wrong. Shouldn't it be pathname.split('/')[1]?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pahwaranger
Mar 17, 2017
Author
Contributor
I am running this on my own deployment and it is working. Not sure how to explain this though, your logic is also correct. I'll do some more testing and update later.
This comment has been minimized.
This comment has been minimized.
pahwaranger
Mar 17, 2017
Author
Contributor
Wow, so it happened to be that I was always testing with 0 as the file index. Number('') resolves to 0. Will update the PR
This comment has been minimized.
This comment has been minimized.
|
@feross good catch, I have updated the PR. PTAL |
This comment has been minimized.
This comment has been minimized.
|
Released as 0.98.14. |
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
May 3, 2018
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
pahwaranger commentedMar 16, 2017
This allows you to add the filename to the path with produces more readable and understandable URLs. It doesn't actually do anything with or require the additional URL params so it shouldn't break any existing deployments.
Current URL:
localhost:3000/0New URL:
localhost:3000/0/FILE_NAME.mp4