Skip to content

FIX Make backURL respect subdirectory path#11803

Merged
emteknetnz merged 1 commit intosilverstripe:6.0from
creative-commoners:pulls/6.0/subfolder-admin-redirect
Jul 27, 2025
Merged

FIX Make backURL respect subdirectory path#11803
emteknetnz merged 1 commit intosilverstripe:6.0from
creative-commoners:pulls/6.0/subfolder-admin-redirect

Conversation

@GuySartorelli
Copy link
Copy Markdown
Member

@GuySartorelli GuySartorelli commented Jul 25, 2025

I have also checked for other cases where the backURL query string gets set and those were all already using various ways to include the subdirectory in the path.

I can't find a sensible way to directly test this, because the SS_BASE_URL environment variable is consumed to set the BASE_URL constant which happens during test bootstrapping, which is before I can get at it to update the test.

Instead I've opted to use Director.alternate_base_url which at least checks that Director::baseURL() is being used correctly here.

Issue

Comment thread src/Control/Director.php
// e.g. `index.php/`
if (defined('BASE_SCRIPT_URL')) {
return $baseURL . BASE_SCRIPT_URL;
return rtrim($baseURL . BASE_SCRIPT_URL, '/') . '/';
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is technically not related, but matches how the other two scenarios in this method work. This method should always return a value with a trailing slash.

@GuySartorelli GuySartorelli marked this pull request as draft July 25, 2025 00:53
@GuySartorelli GuySartorelli marked this pull request as ready for review July 25, 2025 01:07
@GuySartorelli GuySartorelli force-pushed the pulls/6.0/subfolder-admin-redirect branch from d9e4856 to d820364 Compare July 25, 2025 01:07
@GuySartorelli GuySartorelli force-pushed the pulls/6.0/subfolder-admin-redirect branch from d820364 to a3c0cac Compare July 25, 2025 01:08
@seppzzz
Copy link
Copy Markdown

seppzzz commented Jul 25, 2025

This works now.
Thanks for fixing!

@emteknetnz emteknetnz merged commit 8318db4 into silverstripe:6.0 Jul 27, 2025
12 checks passed
@emteknetnz emteknetnz deleted the pulls/6.0/subfolder-admin-redirect branch July 27, 2025 22:54
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