feat: simplify data and add cache to LocalFsAdapter

This commit is contained in:
Max Richter
2025-10-05 22:20:43 +02:00
parent fa283d5dd7
commit 6d92c92797
8 changed files with 196 additions and 160 deletions

View File

@@ -3,10 +3,8 @@ package adapters
import (
"errors"
"mime"
"os"
"path/filepath"
"strings"
"time"
)
func SafeRel(root, requested string) (string, error) {
@@ -37,20 +35,6 @@ func ResponsePath(root, full string) string {
return "/" + filepath.ToSlash(rel)
}
func sizeOrZero(fi os.FileInfo) int64 {
if fi == nil {
return 0
}
return fi.Size()
}
func modTimeOrZero(fi os.FileInfo) time.Time {
if fi == nil {
return time.Time{}
}
return fi.ModTime()
}
var textPlainExtensions = map[string]bool{
".txt": true,
".log": true,