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

add filename to path #1078

merged 1 commit into from Mar 17, 2017

Conversation

@pahwaranger
Copy link
Contributor

pahwaranger commented Mar 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/0

New URL:
localhost:3000/0/FILE_NAME.mp4

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

DiegoRBaquero commented Mar 16, 2017

Sure, why not.

Copy link
Member

DiegoRBaquero left a comment

LGTM

@@ -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.

Copy link
@feross

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.

Copy link
@feross

feross Mar 16, 2017

Member
'/0/file.mp4'.split('/')   // [ '', '0', 'file.mp4' ]

This comment has been minimized.

Copy link
@pahwaranger

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.

Copy link
@pahwaranger

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

@pahwaranger

This comment has been minimized.

Copy link
Contributor Author

pahwaranger commented Mar 17, 2017

@feross good catch, I have updated the PR. PTAL

@feross
feross approved these changes Mar 17, 2017
@feross feross merged commit 34647e4 into webtorrent:master Mar 17, 2017
3 checks passed
3 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@feross

This comment has been minimized.

Copy link
Member

feross commented Mar 17, 2017

Released as 0.98.14.

@lock

This comment has been minimized.

Copy link

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.