Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Fix - closing a file after File.Create
KrzysztofPajak21ec3c89be01
diff --git a/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs b/src/Business/Grand.Business.Storage/Services/FileSystemStore.csindex 2b8e1ab90..caaff10d7 100644--- a/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs+++ b/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs@@ -299,6 +299,9 @@ namespace Grand.Business.Storage.Services{var physicalPath = GetPhysicalPath(path);+ if (!File.Exists(physicalPath))+ File.Create(physicalPath).Close();+return File.WriteAllTextAsync(physicalPath, text, Encoding.UTF8);}@@ -313,7 +316,7 @@ namespace Grand.Business.Storage.Services{path = this.NormalizePath(path);- var physicalPath = String.IsNullOrEmpty(path) ? _fileSystemPath : Path.Combine(_fileSystemPath, path);+ var physicalPath = string.IsNullOrEmpty(path) ? _fileSystemPath : Path.Combine(_fileSystemPath, path);// Verify that the resulting path is inside the root file system path.var pathIsAllowed = Path.GetFullPath(physicalPath).StartsWith(_fileSystemPath, StringComparison.OrdinalIgnoreCase);