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

SS5: Remove trailing slash from SiteTree links if no action present #2771

Conversation

xini
Copy link
Contributor

@xini xini commented Aug 26, 2022

This change helps normalising and canonicalisation of URLs. This picks up #2631 again for SS5.

SiteTree::RelativeLink() is currently the only place in SS where a trailing slash is added to a URL when there is no $action parameter given.

Controller::join_links() already adds slashes between sections of the path, the explicit slash in RelativeLink() is not needed.

Classes that don't use Controller::join_links() at all, e.g. https://github.com/silverstripe/silverstripe-framework/blob/4/src/ORM/PaginatedList.php#L446-L453 use the current request, which never has a trailing slash.

Parent issue

@GuySartorelli
Copy link
Member

@xini We've added some acceptance criteria to #2780
Can you please modify this PR to meet those acceptance criteria?

@GuySartorelli GuySartorelli force-pushed the fix-5-remove-trailing-slash-from-sitetree-links branch from 3ffdfbc to 79f5877 Compare January 12, 2023 03:14
@GuySartorelli
Copy link
Member

Rebased, added necessary JS changes, and squashed commits.
Note that this PR will need to be modified once silverstripe/webpack-config#57 has been merged and released in NPM.

@GuySartorelli GuySartorelli marked this pull request as draft January 12, 2023 03:15
@GuySartorelli GuySartorelli force-pushed the fix-5-remove-trailing-slash-from-sitetree-links branch 2 times, most recently from 6222b8b to 8b15a90 Compare January 17, 2023 21:36
@GuySartorelli GuySartorelli force-pushed the fix-5-remove-trailing-slash-from-sitetree-links branch from 8b15a90 to 18cb6d4 Compare January 20, 2023 02:08
@GuySartorelli GuySartorelli marked this pull request as ready for review January 20, 2023 02:09
@GuySartorelli
Copy link
Member

webpack-config changes are now included in this PR

@GuySartorelli
Copy link
Member

Failing JS tests are going to be dealt with in silverstripe/silverstripe-admin#1421

@GuySartorelli GuySartorelli merged commit 37af732 into silverstripe:5 Jan 20, 2023
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.

3 participants