mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-07 12:24:26 +00:00
fix(staticweb): add nil check to WithStripPrefix helper
Prevent panic when WithStripPrefix is called with a nil provider.
This commit is contained in:
@@ -51,8 +51,10 @@ type PrefixStrippingProvider interface {
|
||||
// WithStripPrefix is a helper function that sets the strip prefix on a provider
|
||||
// if it implements PrefixStrippingProvider. Returns the provider for method chaining.
|
||||
func WithStripPrefix(provider FileSystemProvider, prefix string) FileSystemProvider {
|
||||
if p, ok := provider.(PrefixStrippingProvider); ok {
|
||||
p.WithStripPrefix(prefix)
|
||||
if provider != nil {
|
||||
if p, ok := provider.(PrefixStrippingProvider); ok {
|
||||
p.WithStripPrefix(prefix)
|
||||
}
|
||||
}
|
||||
return provider
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user