enable easier MIME type detection
1 file changed, 7 insertions(+), 5 deletions(-)
changed files
M internal/storage/sqlite/writer.go → internal/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 == "" {