Remove UmbracoPath setting (#16037)

* Use require modifier instead of setting null-suppressed default values

* Only remove read-only properties when IgnoreReadOnlyProperties is set

* Obsolete UmbracoPath property and remove work-around for obsolete setter

* Remove UmbracoPath setting and use constant instead

* Remove usage of GetBackOfficePath

* Add IHostingEnvironment.GetBackOfficePath() extension method

* Add Constants.System.UmbracoPathSegment constant

* Update Constants.System XML docs

* Replace StringBuilder with string interpolation

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>

* Fix syntax error

* Removed uses of obsoletes.

* Further obsolete messages.

* Cleaned up usings.

* Update src/Umbraco.Infrastructure/Install/FilePermissionHelper.cs

Co-authored-by: Ronald Barendse <ronald@barend.se>

---------

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
Ronald Barendse
2025-03-03 07:38:30 +01:00
committed by GitHub
parent 561d871677
commit 780184e553
35 changed files with 237 additions and 453 deletions

View File

@@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Cms.Core.Logging;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.PublishedContent;
@@ -141,7 +142,7 @@ public abstract class UmbracoViewPage<TModel> : RazorPage<TModel>
markupToInject =
string.Format(
ContentSettings.PreviewBadge,
HostingEnvironment.ToAbsolute(Core.Constants.System.DefaultUmbracoPath),
HostingEnvironment.GetBackOfficePath(),
System.Web.HttpUtility.HtmlEncode(Context.Request.GetEncodedUrl()), // Belt and braces - via a browser at least it doesn't seem possible to have anything other than
// a valid culture code provided in the querystring of this URL.
// But just to be sure of prevention of an XSS vulnterablity we'll HTML encode here too.