Fix exporting/importing macro partial views using a virtual file path

This commit is contained in:
Ronald Barendse
2021-09-21 11:22:40 +02:00
parent 8b853b17ac
commit a9d8f5fa5b
2 changed files with 15 additions and 30 deletions

View File

@@ -1270,6 +1270,17 @@ namespace Umbraco.Cms.Infrastructure.Packaging
throw new InvalidOperationException("No path attribute found");
}
// Remove prefix to maintain backwards compatibility
if (path.StartsWith(Constants.SystemDirectories.MacroPartials))
{
path = path.Substring(Constants.SystemDirectories.MacroPartials.Length);
}
else if (path.StartsWith("~"))
{
_logger.LogWarning("Importing macro partial views outside of the Views/MacroPartials directory is not supported: {Path}", path);
continue;
}
IPartialView macroPartialView = _fileService.GetPartialViewMacro(path);
// only update if it doesn't exist