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

always remove trailing slashes #267

Merged
merged 2 commits into from
Dec 13, 2020
Merged

always remove trailing slashes #267

merged 2 commits into from
Dec 13, 2020

Conversation

Rich-Harris
Copy link
Member

@@ -7,6 +7,17 @@ function md5(body) {
}

export async function render(request, options) {
if (request.path.endsWith('/') && request.path !== '/') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in Sapper I believe we're currently avoiding using String#endsWith on the client, which isn't present on certain old browsers, and would require a prototype-modifying polyfill to implement. Are there any goals with Kit about what we want to do about that sort of thing? In this case, could we just use some other simple code instead, especially since it's a string of fixed length 1 we're looking for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think a prototype-modifying polyfill is probably acceptable for something like that. we could always recommend a particular https://polyfill.io/v3/ URL for people to add to their app.html files. (probably best not to automatically inject, because they might need to add their own polyfills). though you've reminded me that the code here only runs on the server, and we would need something equivalent in the client-side router

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

Successfully merging this pull request may close these issues.

2 participants