open-next icon indicating copy to clipboard operation
open-next copied to clipboard

Trailing slash appended to robots.txt and sitemap.xml

Open leanderiversen opened this issue 3 years ago • 5 comments

Hi again,

I have found a new issue regarding trailing slashes, and can confirm that it is present in at least 2.2.3 and 2.2.4. The robots.txt (app/robots.ts) and sitemap.xml (app/sitemap.ts) files get a trailing slash appended, when they were previously left alone.

Happy to provide more details if required.

Thank you.

leanderiversen avatar Oct 17 '23 18:10 leanderiversen

Are these special files that shouldn't have a trailing slash, even if trailingSlash is true?

khuezy avatar Oct 17 '23 18:10 khuezy

@khuezy That is correct. They should "live" at root level, and not have a trailing slash, even if trailingSlash is true.

The documentation can be found here and here.

leanderiversen avatar Oct 17 '23 18:10 leanderiversen

Cool thanks, are there any other special files that need to behave like this?

khuezy avatar Oct 17 '23 18:10 khuezy

It looks like there is app/manifest.ts as well, but I think that is the complete list.

leanderiversen avatar Oct 17 '23 18:10 leanderiversen

Looks like the recent PR to split the query string is adding a trailing slash no matter what: https://github.com/sst/open-next/pull/280/files#diff-ff1fb48147815ebc0cc31b6cd919e5d6eb405aa532707b0b2d0f90cd730a2a9cR184 Should only add trailing slash if trailingSlash is true AND it's not one of the exception above.

Can you create a PR for this?

khuezy avatar Oct 17 '23 18:10 khuezy