mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-05-24 07:53:45 +00:00
feat(staticweb): enhance fallback logic for extensionless paths
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Failing after -35m7s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Failing after -35m7s
Build , Vet Test, and Lint / Lint Code (push) Failing after -35m7s
Build , Vet Test, and Lint / Build (push) Failing after -35m7s
Tests / Unit Tests (push) Failing after -35m8s
Tests / Integration Tests (push) Failing after -35m8s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Failing after -35m7s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Failing after -35m7s
Build , Vet Test, and Lint / Lint Code (push) Failing after -35m7s
Build , Vet Test, and Lint / Build (push) Failing after -35m7s
Tests / Unit Tests (push) Failing after -35m8s
Tests / Integration Tests (push) Failing after -35m8s
* Added support for serving index.html for extensionless paths * Updated isStaticAsset to exclude paths without extensions from static asset checks
This commit is contained in:
@@ -49,9 +49,15 @@ func (f *HTMLFallbackStrategy) GetFallbackPath(filePath string) string {
|
||||
return f.indexFile
|
||||
}
|
||||
|
||||
// isStaticAsset checks if the path looks like a static asset (has a file extension).
|
||||
// isStaticAsset checks if the path looks like a static asset (has a non-HTML file extension).
|
||||
// Paths with no extension are not considered static assets so fallback logic can resolve
|
||||
// them to path.html or path/index.html.
|
||||
func (f *HTMLFallbackStrategy) isStaticAsset(filePath string) bool {
|
||||
return path.Ext(filePath) != ""
|
||||
ext := strings.ToLower(path.Ext(filePath))
|
||||
if ext == "" || ext == ".html" || ext == ".htm" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// ExtensionBasedFallback implements a fallback strategy that skips fallback for known static file extensions.
|
||||
|
||||
Reference in New Issue
Block a user