Fixes issue during upgrade where umbraco can't clear cdf log files

This commit is contained in:
Shannon
2019-07-12 02:57:26 +02:00
committed by Bjarke Berg
parent 78735ff349
commit 77dda5a70f

View File

@@ -106,8 +106,10 @@ namespace Umbraco.Web.JavaScript
}
try
{
var fullPath = currentHttpContext.Server.MapPath(XmlFileMapper.FileMapDefaultFolder);
{
var fullPath = XmlFileMapper.FileMapDefaultFolder.StartsWith("~/")
? currentHttpContext.Server.MapPath(XmlFileMapper.FileMapDefaultFolder)
: XmlFileMapper.FileMapDefaultFolder;
if (fullPath != null)
{
cdfTempDirectories.Add(fullPath);
@@ -122,13 +124,12 @@ namespace Umbraco.Web.JavaScript
var success = true;
foreach (var directory in cdfTempDirectories)
{
var directoryInfo = new DirectoryInfo(directory);
if (directoryInfo.Exists == false)
continue;
try
{
directoryInfo.Delete(true);
if (!Directory.Exists(directory))
continue;
Directory.Delete(directory, true);
}
catch (Exception ex)
{