mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-09 13:04:24 +00:00
feat(staticweb): add path prefix stripping to all filesystem providers
Add PrefixStrippingProvider interface and implement it in all providers (EmbedFSProvider, LocalFSProvider, ZipFSProvider) to support serving files from subdirectories at the root level.
This commit is contained in:
@@ -142,12 +142,10 @@ func (p *EmbedFSProvider) ZipFile() string {
|
||||
// WithStripPrefix sets the prefix to strip from requested paths.
|
||||
// For example, WithStripPrefix("/dist") will make files at "/dist/assets"
|
||||
// accessible via "/assets".
|
||||
// Returns the provider for method chaining.
|
||||
func (p *EmbedFSProvider) WithStripPrefix(prefix string) *EmbedFSProvider {
|
||||
func (p *EmbedFSProvider) WithStripPrefix(prefix string) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.stripPrefix = prefix
|
||||
return p
|
||||
}
|
||||
|
||||
// StripPrefix returns the configured strip prefix.
|
||||
|
||||
Reference in New Issue
Block a user