Skip to content

Support for "." in pathnames #132

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

Open
patrikpessi opened this issue Feb 9, 2022 · 2 comments
Open

Support for "." in pathnames #132

patrikpessi opened this issue Feb 9, 2022 · 2 comments

Comments

@patrikpessi
Copy link

Problem

I have a single page app with routes to specific versions of documents

Example path from my app: /documents/:documentName/:version/:langVariant
Example match for the path: /documents/document1/1.8.3/en

Sirv chokes on the . character and throws a 404 thinking that everything after the last period is a file extension.

Suggestion

Changing the regex on line: 136 in package/sirv/index.js from

ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/); // any extn

to something around the lines of

ignores.push(/[/]([A-Za-z\s\d~$._-]+\.[\w]+)[^.\d(?=\/\n)]{1,}$/); // any extn

seems to work for this.

Matches for the suggested regex:

Matches:
/style.js
/assets/style.js
/assets/fonts/font.ttf
/assets/zip/files.7zip

Doesnt match:
/documents/1.8.3/en
/documents/1.2.3
/documents/1317983
@patrikpessi patrikpessi changed the title Support for paths with numbers Support for "." in pathnames Feb 9, 2022
@Cigan12
Copy link

Cigan12 commented Apr 21, 2025

Have you been able to find a solution yet?

@patrikpessi
Copy link
Author

Have you been able to find a solution yet?

I forked the repo and had a different regex for matching file extensions which worked for my needs.
patrikpessi@dc17146
I havent updated the fork in a bit since I moved to using a different tool.

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

No branches or pull requests

2 participants