feat: simplify data and add cache to LocalFsAdapter
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user