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

Extensions option breaks if local path contains a dot anywhere #79

Closed
razor-x opened this issue May 6, 2017 · 4 comments
Closed

Extensions option breaks if local path contains a dot anywhere #79

razor-x opened this issue May 6, 2017 · 4 comments
Assignees
Labels

Comments

@razor-x
Copy link

razor-x commented May 6, 2017

The regex in this line will match paths with a dot anywhere. In particular if I'm developing in the local folder /home/razorx/web/example.com and try to use the extensions option to serve /foo then path = /home/razorx/web/example.com/foo and will match the regex thus skipping the if block.

 if (extensions && !/\..*$/.exec(path)) {
@haoxins haoxins self-assigned this May 8, 2017
@haoxins haoxins added the bug label May 8, 2017
@Necromos
Copy link
Contributor

Isn't it fixed with #92 ?

@haoxins
Copy link
Member

haoxins commented Apr 27, 2018

yes :)

@haoxins haoxins closed this as completed Apr 27, 2018
@adenflorian
Copy link
Contributor

I don't think this regex works on windows machines, since the directory separators are backslashes \.

I believe the tests are failing on my windows machine, because of this.

We can probably fix it by using basename:

!/\./.exec(basename(path))

@maxweisel
Copy link

@adenflorian I believe your fix reintroduced the bug if the basename contains a dot anywhere. I'm currently running into this issue. I tried switching to @Necromos's regex pattern, but it still fails.

To be honest, I don't fully understand why this regex exists in the first place. Is it to prevent searching for ".html.html" ?

Can we re-open this bug?

Max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants