From f4b3f654796a36af960285eb0e68b1dcb683f7cb Mon Sep 17 00:00:00 2001 From: Sven Geusens Date: Thu, 10 Oct 2024 17:33:45 +0200 Subject: [PATCH] Fix install url detection --- src/Umbraco.Core/Routing/UmbracoRequestPaths.cs | 5 ++++- .../Umbraco.Core/Routing/UmbracoRequestPathsTests.cs | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs b/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs index b70970673a31..f31b9fca0608 100644 --- a/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs +++ b/src/Umbraco.Core/Routing/UmbracoRequestPaths.cs @@ -148,7 +148,10 @@ private static bool IsPluginControllerRoute(string path) /// /// Checks if the current uri is an install request /// - public bool IsInstallerRequest(string absPath) => absPath.InvariantStartsWith(_installPath); + public bool IsInstallerRequest(string absPath) => + absPath.InvariantEquals(_installPath) + || absPath.InvariantStartsWith(_installPath.EnsureEndsWith('/')) + || absPath.InvariantStartsWith(_installPath.EnsureEndsWith('?')); /// /// Rudimentary check to see if it's not a server side request diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Routing/UmbracoRequestPathsTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Routing/UmbracoRequestPathsTests.cs index d4856c2b1213..9c0e4cbb16f0 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Routing/UmbracoRequestPathsTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Routing/UmbracoRequestPathsTests.cs @@ -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);