From 4a0d364d10032d007e60d959d7f495e4ccadb760 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 14 Nov 2023 09:14:01 +0100 Subject: [PATCH] Post fix --- .../Implement/CreatedPackageSchemaRepository.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs index 8152eb70e9..6fcb0c9e66 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CreatedPackageSchemaRepository.cs @@ -309,15 +309,17 @@ public class CreatedPackageSchemaRepository : ICreatedPackagesRepository _hostingEnvironment.MapPathContentRoot(Path.Combine( _createdPackagesFolderPath, definition.Name.Replace(' ', '_'))); - Directory.CreateDirectory(directoryName); - var expectedRoot = _hostingEnvironment.MapPathContentRoot(_createdPackagesFolderPath); - var finalPackagePath = Path.Combine(directoryName, fileName); + var expectedRoot = Path.GetFullPath(_hostingEnvironment.MapPathContentRoot(_createdPackagesFolderPath)); + var finalPackagePath = Path.GetFullPath(Path.Combine(directoryName, fileName)); if (finalPackagePath.StartsWith(expectedRoot) == false) { throw new IOException("Invalid path due to the package name"); } + Directory.CreateDirectory(directoryName); + + // Clean existing files foreach (var packagePath in new[] { definition.PackagePath, finalPackagePath }) {