all repos — homestead @ 5ca6e013dfd43d10cd32486df0e817d3679ca3dd

Code for my website

enable easier MIME type detection

Alan Pearce
commit

5ca6e013dfd43d10cd32486df0e817d3679ca3dd

parent

0c6f24968bf2ce9b83dd6897de1a1a554891401c

1 file changed, 7 insertions(+), 5 deletions(-)

changed files
M internal/storage/sqlite/writer.gointernal/storage/sqlite/writer.go
@@ -10,13 +10,13 @@ "net/http"
"path/filepath" "time" - "github.com/andybalholm/brotli" - "github.com/klauspost/compress/gzip" - "github.com/klauspost/compress/zstd" "alin.ovh/homestead/internal/buffer" "alin.ovh/homestead/internal/content" "alin.ovh/homestead/internal/storage" "alin.ovh/x/log" + "github.com/andybalholm/brotli" + "github.com/klauspost/compress/gzip" + "github.com/klauspost/compress/zstd" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fmsg"
@@ -209,6 +209,7 @@ func (s *Writer) NewFileFromPost(post *content.Post) *storage.File {
file := &storage.File{ Title: post.Title, Path: post.URL, + FSPath: pathNameToFileName(post.URL), LastModified: post.Date, Encodings: map[string]*buffer.Buffer{}, }
@@ -225,7 +226,8 @@
func (s *Writer) Write(pathname string, title string, content *buffer.Buffer) error { file := &storage.File{ Title: title, - Path: pathname, + Path: cleanPathName(pathname), + FSPath: pathname, LastModified: time.Now(), Encodings: map[string]*buffer.Buffer{}, }
@@ -247,7 +249,7 @@ }
file.Encodings["identity"] = content if file.ContentType == "" { - file.ContentType = contentType(file.Path) + file.ContentType = contentType(file.FSPath) } if file.Etag == "" {