Fixed issue with /~ folder created doing install

This commit is contained in:
Bjarke Berg
2021-02-22 12:51:17 +01:00
parent b4fd47e3a8
commit 9123c06aec

View File

@@ -7,12 +7,12 @@ using System.IO;
using System.Linq;
using System.Security.AccessControl;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Hosting;
using Umbraco.Cms.Core.Install;
using Umbraco.Cms.Core.IO;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Infrastructure.Install
{
@@ -27,6 +27,7 @@ namespace Umbraco.Infrastructure.Install
private readonly string[] _permissionFiles = Array.Empty<string>();
private readonly GlobalSettings _globalSettings;
private readonly IIOHelper _ioHelper;
private readonly IHostingEnvironment _hostingEnvironment;
private string _basePath;
/// <summary>
@@ -36,6 +37,7 @@ namespace Umbraco.Infrastructure.Install
{
_globalSettings = globalSettings.Value;
_ioHelper = ioHelper;
_hostingEnvironment = hostingEnvironment;
_basePath = hostingEnvironment.MapPathContentRoot("/");
_permissionDirs = new[]
{
@@ -68,7 +70,7 @@ namespace Umbraco.Infrastructure.Install
EnsureFiles(_permissionFiles, out errors);
report[FilePermissionTest.FileWriting] = errors.ToList();
EnsureCanCreateSubDirectory(_globalSettings.UmbracoMediaPath, out errors);
EnsureCanCreateSubDirectory(_hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoMediaPath), out errors);
report[FilePermissionTest.MediaFolderCreation] = errors.ToList();
return report.Sum(x => x.Value.Count()) == 0;