28 lines
572 B
C#
28 lines
572 B
C#
namespace zero.FileStorage;
|
|
|
|
public class WebRootFileSystem : PhysicalFileSystem, IWebRootFileSystem
|
|
{
|
|
protected string PublicPathPrefix { get; }
|
|
|
|
|
|
public WebRootFileSystem(string root, string publicPathPrefix) : base(root)
|
|
{
|
|
PublicPathPrefix = (publicPathPrefix ?? string.Empty).EnsureEndsWith('/');
|
|
}
|
|
|
|
|
|
/// <inheritdoc />
|
|
public override string MapToPublicPath(string path)
|
|
{
|
|
if (path.IsNullOrEmpty())
|
|
{
|
|
return null;
|
|
}
|
|
return PublicPathPrefix + path.TrimStart('/');
|
|
}
|
|
}
|
|
|
|
|
|
public interface IWebRootFileSystem : IFileSystem
|
|
{
|
|
} |