2026-04-07 14:23:29 +02:00
|
|
|
namespace Finch.FileStorage;
|
2022-12-07 14:05:11 +01:00
|
|
|
|
|
|
|
|
public class WebRootFileSystem : PhysicalFileSystem, IWebRootFileSystem
|
|
|
|
|
{
|
|
|
|
|
protected string PublicPathPrefix { get; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WebRootFileSystem(string root, string publicPathPrefix) : base(root)
|
|
|
|
|
{
|
2026-04-07 15:22:10 +02:00
|
|
|
PublicPathPrefix = (publicPathPrefix ?? string.Empty).EnsureEndsWith('/');
|
2022-12-07 14:05:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public override string MapToPublicPath(string path)
|
|
|
|
|
{
|
|
|
|
|
if (path.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return PublicPathPrefix + path.TrimStart('/');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface IWebRootFileSystem : IFileSystem
|
|
|
|
|
{
|
|
|
|
|
}
|