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

7919: The Alias UI links for sites using UrlPrefix are broken #7930

Merged

Conversation

Hazzamanic
Copy link
Contributor

@Hazzamanic Hazzamanic commented Jan 5, 2018

Fixes #7919. Also reverting this commit's changes to the Href method (9c2ea80#diff-3806ff11c9d923fac04777c83296a19e) that overrode this commit a489493 that fixed this issue #4540

…hat strips first / in urls for sites using UrlPrefix
@sebastienros
Copy link
Member

Looks good, but can someone try it and confirm it fixes the issue? I am worried as the code explicitly handled the prefix.

@BenedekFarkas BenedekFarkas changed the title Fixing issue #7919 7919: The Alias UI links for sites using UrlPrefix are broken Apr 10, 2024
@BenedekFarkas BenedekFarkas linked an issue Apr 10, 2024 that may be closed by this pull request
@BenedekFarkas
Copy link
Member

@sebastienros tested and slightly adjusted, good to go!

@BenedekFarkas BenedekFarkas merged commit 8086c01 into OrchardCMS:1.10.x Apr 11, 2024
2 checks passed
if (!string.IsNullOrWhiteSpace(_tenantPrefix)
&& path.StartsWith("~/")
&& !CommonLocations.Any(gpp => path.StartsWith(gpp, StringComparison.OrdinalIgnoreCase))) {
return base.Href("~/" + _tenantPrefix + path.Substring(1), pathParts);
Copy link
Contributor

@AndreaPiovanelli AndreaPiovanelli Apr 12, 2024

Choose a reason for hiding this comment

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

Why is the substring start index parameter changed?
Since code gets to line 196 only if path starts with ~, it stripped ~/ in the previous version of the file; now it only strips the ~ character: is it correct keeping the / character?

Copy link
Member

@BenedekFarkas BenedekFarkas Apr 12, 2024

Choose a reason for hiding this comment

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

FYI this is only applied if there is a tenant prefix. e.g., the base URL is mysite.com/mytenant. In this case you still need the / between the tenant prefix and the rest of the path. Without this change all the Hrefs were broken if you provided a path that started with ~/ when there's a tenant prefix.

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.

The Alias UI links for sites using UrlPrefix are broken
4 participants