FIX Correct trailing slash for locale in another domain #872
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/tractorcow-farm/silverstripe-fluent/actions/runs/10362465353/job/28684501581 which consists of failures like the below:
As of silverstripe/framework 5.2.20,
Controller::normaliseTrailingSlash()
won't normalise trailing slash for absolute URLs where the domain doesn't match the current site domain.This means if getting a link to a page on Locale A from Locale B, if the domains don't match, the trailing slash won't be normalised.
updateLink()
works in conjunction withupdateRelativeLink()
, so for pages other than the home page the trailing slash is normalised already inupdateRelativeLink()
. But for home pagesupdateRelativeLink()
will always resolve to'/'
, which means before this PR, a trailing slash would always be added for home page links in different locales where domains don't match.Note that this PR doesn't attempt to resolve this for any other type of data object.
It's possible that it would be better to implement the
updateIsSiteUrl()
extension hook inFluentDirectorExtension
and saying "yes that's a site URL" if it belongs to a domain of any locale. I didn't attempt that because I don't know what sort of flow-on effects that might have. I'm especially hesitant to do that in a patch release.@tractorcow do you have any thoughts on this?
Issue