diff --git a/Oqtane.Server/Controllers/FileController.cs b/Oqtane.Server/Controllers/FileController.cs index 5b22b062..5e57e3e5 100644 --- a/Oqtane.Server/Controllers/FileController.cs +++ b/Oqtane.Server/Controllers/FileController.cs @@ -431,12 +431,12 @@ namespace Oqtane.Controllers private string GetFolderPath(Folder folder) { - return Path.Combine(_environment.ContentRootPath, "Content", "Tenants", _tenants.GetTenant().TenantId.ToString(), "Sites", folder.SiteId.ToString(), folder.Path, " ").TrimEnd(' '); + return Path.Combine(_environment.ContentRootPath, "Content", "Tenants", _tenants.GetTenant().TenantId.ToString(), "Sites", folder.SiteId.ToString(), folder.Path); } private string GetFolderPath(string folder) { - return Path.Combine(_environment.WebRootPath, folder, " ").TrimEnd(' '); + return Path.Combine(_environment.WebRootPath, folder); } private void CreateDirectory(string folderpath) @@ -448,7 +448,7 @@ namespace Oqtane.Controllers string[] folders = folderpath.Split(separators, StringSplitOptions.RemoveEmptyEntries); foreach (string folder in folders) { - path = Path.Combine(path, folder); + path = Path.Combine(path, folder," ").TrimEnd(' '); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); diff --git a/Oqtane.Server/Controllers/FolderController.cs b/Oqtane.Server/Controllers/FolderController.cs index a1e48fc1..b74fcdde 100644 --- a/Oqtane.Server/Controllers/FolderController.cs +++ b/Oqtane.Server/Controllers/FolderController.cs @@ -110,7 +110,7 @@ namespace Oqtane.Controllers if (string.IsNullOrEmpty(folder.Path) && folder.ParentId != null) { Folder parent = _folders.GetFolder(folder.ParentId.Value); - folder.Path = Path.Combine(parent.Path, folder.Name); + folder.Path = Path.Combine(parent.Path, folder.Name," ").TrimEnd(' '); } folder = _folders.AddFolder(folder); _logger.Log(LogLevel.Information, this, LogFunction.Create, "Folder Added {Folder}", folder); @@ -135,7 +135,7 @@ namespace Oqtane.Controllers if (string.IsNullOrEmpty(folder.Path) && folder.ParentId != null) { Folder parent = _folders.GetFolder(folder.ParentId.Value); - folder.Path = Path.Combine(parent.Path, folder.Name); + folder.Path = Path.Combine(parent.Path, folder.Name, " ").TrimEnd(' '); } folder = _folders.UpdateFolder(folder); _logger.Log(LogLevel.Information, this, LogFunction.Update, "Folder Updated {Folder}", folder); diff --git a/Oqtane.Server/Controllers/ModuleDefinitionController.cs b/Oqtane.Server/Controllers/ModuleDefinitionController.cs index 03e1937f..ce6a7001 100644 --- a/Oqtane.Server/Controllers/ModuleDefinitionController.cs +++ b/Oqtane.Server/Controllers/ModuleDefinitionController.cs @@ -193,13 +193,13 @@ namespace Oqtane.Controllers if (moduleDefinition.Template == "internal") { - rootPath = rootFolder.FullName; + rootPath = Path.Combine(rootFolder.FullName," ").TrimEnd(' '); moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, Oqtane.Client"; moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, Oqtane.Server"; } else { - rootPath = Path.Combine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module"); + rootPath = Path.Combine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module", " ").TrimEnd(' '); moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Client"; moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Server"; } diff --git a/Oqtane.Server/Controllers/UserController.cs b/Oqtane.Server/Controllers/UserController.cs index dfcb5b48..fe1da778 100644 --- a/Oqtane.Server/Controllers/UserController.cs +++ b/Oqtane.Server/Controllers/UserController.cs @@ -13,6 +13,7 @@ using System.Net; using Oqtane.Enums; using Oqtane.Infrastructure; using Oqtane.Repository; +using System.IO; namespace Oqtane.Controllers { @@ -150,7 +151,8 @@ namespace Oqtane.Controllers } // add folder for user - Folder folder = _folders.GetFolder(user.SiteId, "Users"); + string usersPath = Path.Combine("Users"," ").TrimEnd(' '); + Folder folder = _folders.GetFolder(user.SiteId, usersPath); if (folder != null) { _folders.AddFolder(new Folder @@ -158,7 +160,7 @@ namespace Oqtane.Controllers SiteId = folder.SiteId, ParentId = folder.FolderId, Name = "My Folder", - Path = System.IO.Path.Combine(folder.Path, newUser.UserId.ToString()), + Path = Path.Combine(folder.Path, newUser.UserId.ToString(), " ").TrimEnd(' '), Order = 1, IsSystem = true, Permissions = "[{\"PermissionName\":\"Browse\",\"Permissions\":\"[" + newUser.UserId.ToString() + "]\"},{\"PermissionName\":\"View\",\"Permissions\":\"All Users\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"[" + diff --git a/Oqtane.Server/Infrastructure/DatabaseManager.cs b/Oqtane.Server/Infrastructure/DatabaseManager.cs index 40f30092..a51c0238 100644 --- a/Oqtane.Server/Infrastructure/DatabaseManager.cs +++ b/Oqtane.Server/Infrastructure/DatabaseManager.cs @@ -387,14 +387,15 @@ namespace Oqtane.Infrastructure } // add folder for user - var folder = folderRepository.GetFolder(user.SiteId, "Users"); + string usersPath = Path.Combine("Users", " ").TrimEnd(' '); + var folder = folderRepository.GetFolder(user.SiteId, usersPath); if (folder != null) folderRepository.AddFolder(new Folder { SiteId = folder.SiteId, ParentId = folder.FolderId, Name = "My Folder", - Path = Path.Combine(folder.Path, newUser.UserId.ToString()), + Path = Path.Combine(folder.Path, newUser.UserId.ToString(), " ").TrimEnd(' '), Order = 1, IsSystem = true, Permissions = new List diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs index f37d719e..21121689 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -103,7 +103,8 @@ namespace Oqtane.Infrastructure case ".svg": case ".js": case ".css": - filename = Path.Combine(sourceFolder, entry.FullName.Replace("wwwroot", name)); + string entryPath = Path.Combine(entry.FullName.Replace("wwwroot", name).Split("/")); + filename = Path.Combine(sourceFolder, entryPath); if (!Directory.Exists(Path.GetDirectoryName(filename))) { Directory.CreateDirectory(Path.GetDirectoryName(filename)); diff --git a/Oqtane.Server/Infrastructure/SiteTemplates/DefaultSiteTemplate.cs b/Oqtane.Server/Infrastructure/SiteTemplates/DefaultSiteTemplate.cs index 150373a2..26dfaed0 100644 --- a/Oqtane.Server/Infrastructure/SiteTemplates/DefaultSiteTemplate.cs +++ b/Oqtane.Server/Infrastructure/SiteTemplates/DefaultSiteTemplate.cs @@ -134,7 +134,7 @@ namespace Oqtane.SiteTemplates if (System.IO.File.Exists(Path.Combine(_environment.WebRootPath, "images", "logo.png"))) { - string folderpath = Path.Combine(_environment.ContentRootPath, "Content", "Tenants", site.TenantId.ToString(), "Sites", site.SiteId.ToString()); + string folderpath = Path.Combine(_environment.ContentRootPath, "Content", "Tenants", site.TenantId.ToString(), "Sites", site.SiteId.ToString()," ").TrimEnd(); System.IO.Directory.CreateDirectory(folderpath); if (!System.IO.File.Exists(Path.Combine(folderpath, "logo.png"))) {