made folder paths cross platform, introduced file handler for abstracting the serving of files, enabled url mapping for broken file links, resolved public folder deletion issue
This commit is contained in:
@ -38,7 +38,7 @@ namespace Oqtane.Infrastructure
|
||||
// legacy support for client api requests which would include the alias as a path prefix ( ie. {alias}/api/[controller] )
|
||||
int aliasId;
|
||||
string[] segments = httpcontext.Request.Path.Value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (segments.Length > 1 && (segments[1] == "api" || segments[1] == "pages") && int.TryParse(segments[0], out aliasId))
|
||||
if (segments.Length > 1 && Shared.Constants.ReservedRoutes.Contains(segments[1]) && int.TryParse(segments[0], out aliasId))
|
||||
{
|
||||
alias = _aliasRepository.GetAliases().ToList().FirstOrDefault(item => item.AliasId == aliasId);
|
||||
}
|
||||
|
@ -54,6 +54,9 @@ namespace Oqtane.Infrastructure
|
||||
case "3.1.4":
|
||||
Upgrade_3_1_4(tenant, scope);
|
||||
break;
|
||||
case "3.2.0":
|
||||
Upgrade_3_2_0(tenant, scope);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,5 +241,29 @@ namespace Oqtane.Infrastructure
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Upgrade_3_2_0(Tenant tenant, IServiceScope scope)
|
||||
{
|
||||
try
|
||||
{
|
||||
// convert folder paths cross platform format
|
||||
var siteRepository = scope.ServiceProvider.GetRequiredService<ISiteRepository>();
|
||||
var folderRepository = scope.ServiceProvider.GetRequiredService<IFolderRepository>();
|
||||
foreach (Site site in siteRepository.GetSites().ToList())
|
||||
{
|
||||
var folders = folderRepository.GetFolders(site.SiteId);
|
||||
foreach (Folder folder in folders)
|
||||
{
|
||||
folder.Path = folder.Path.Replace("\\", "/");
|
||||
folderRepository.UpdateFolder(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"Oqtane Error: Error In 3.2.0 Upgrade Logic - {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user