Skip to content

Commit

Permalink
Fix install url detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Migaroez committed Oct 10, 2024
1 parent 63a487b commit f4b3f65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Umbraco.Core/Routing/UmbracoRequestPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ private static bool IsPluginControllerRoute(string path)
/// <summary>
/// Checks if the current uri is an install request
/// </summary>
public bool IsInstallerRequest(string absPath) => absPath.InvariantStartsWith(_installPath);
public bool IsInstallerRequest(string absPath) =>
absPath.InvariantEquals(_installPath)
|| absPath.InvariantStartsWith(_installPath.EnsureEndsWith('/'))
|| absPath.InvariantStartsWith(_installPath.EnsureEndsWith('?'));

/// <summary>
/// Rudimentary check to see if it's not a server side request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,15 @@ public void Is_Back_Office_Request(string input, string virtualPath, bool expect
[TestCase("http://www.domain.com/install/test/test", true)]
[TestCase("http://www.domain.com/Install/test/test.aspx", true)]
[TestCase("http://www.domain.com/install/test/test.js", true)]
[TestCase("http://www.domain.com/install?param=value", true)]
[TestCase("http://www.domain.com/instal", false)]
[TestCase("http://www.domain.com/umbraco", false)]
[TestCase("http://www.domain.com/umbraco/umbraco", false)]
[TestCase("http://www.domain.com/installation", false)]
[TestCase("http://www.domain.com/installation/", false)]
[TestCase("http://www.domain.com/installation/test", false)]
[TestCase("http://www.domain.com/installation/test.js", false)]
[TestCase("http://www.domain.com/installation?param=value", false)]
public void Is_Installer_Request(string input, bool expected)
{
var source = new Uri(input);
Expand Down

0 comments on commit f4b3f65

Please sign in to comment.