Fix RTEs stylesheet loading error (#16128)

This commit is contained in:
Kenn Jacobsen
2024-04-25 12:19:41 +02:00
committed by GitHub
parent 37ae17ad20
commit ca84d002a4
2 changed files with 3 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Api.Management.Controllers.StaticFile.Tree;
[ApiExplorerSettings(GroupName = "Static File")]
public class StaticFileTreeControllerBase : FileSystemTreeControllerBase
{
private static readonly string[] _allowedRootFolders = { "App_Plugins", "wwwroot" };
private static readonly string[] _allowedRootFolders = { $"{Path.DirectorySeparatorChar}App_Plugins", $"{Path.DirectorySeparatorChar}wwwroot" };
public StaticFileTreeControllerBase(IPhysicalFileSystem physicalFileSystem)
=> FileSystem = physicalFileSystem;
@@ -35,7 +35,7 @@ public class StaticFileTreeControllerBase : FileSystemTreeControllerBase
? base.GetAncestorModels(path, includeSelf)
: Array.Empty<FileSystemTreeItemPresentationModel>();
private bool IsTreeRootPath(string path) => string.IsNullOrWhiteSpace(path);
private bool IsTreeRootPath(string path) => path == Path.DirectorySeparatorChar.ToString();
private bool IsAllowedPath(string path) => _allowedRootFolders.Contains(path) || _allowedRootFolders.Any(folder => path.StartsWith($"{folder}{Path.DirectorySeparatorChar}"));
}

View File

@@ -6,5 +6,5 @@ internal static class StringPathExtensions
{
public static string SystemPathToVirtualPath(this string systemPath) => systemPath.Replace('\\', '/').TrimStart('~').EnsureStartsWith('/');
public static string VirtualPathToSystemPath(this string virtualPath) => virtualPath.TrimStart('/').Replace('/', Path.DirectorySeparatorChar);
public static string VirtualPathToSystemPath(this string virtualPath) => virtualPath.Replace('/', Path.DirectorySeparatorChar).EnsureStartsWith(Path.DirectorySeparatorChar);
}