use files instead of buffers for serving
5 files changed, 39 insertions(+), 36 deletions(-)
M domain/content/builder/builder.go → domain/content/builder/builder.go
@@ -158,7 +158,6 @@ } file := &storage.File{ Title: title, LastModified: matchingPosts[0].Date, - ContentType: "application/xml", Path: path.Join("/tags", tag, "atom.xml"), FSPath: path.Join("/tags", tag, "atom.xml"), }@@ -191,7 +190,6 @@ } file := &storage.File{ Title: config.Title, LastModified: cc.Posts[0].Date, - ContentType: "application/xml", Path: "/atom.xml", FSPath: "/atom.xml", }@@ -237,7 +235,6 @@ return fault.Wrap(err) } } file := stor.NewFileFromPost(post) - file.ContentType = "text/html; charset=utf-8" if err := stor.WriteFile(file, buf); err != nil { return fault.Wrap(err) }
M domain/web/mux.go → domain/web/mux.go
@@ -68,8 +68,10 @@ enc := nego.NegotiateContentEncoding(r, file.AvailableEncodings()...) if enc != "" { w.Header().Add("Content-Encoding", enc) } - w.Header().Add("Content-Type", file.ContentType) - if file.ContentType == "application/xml" { + mime := file.GetContentType() + w.Header().Add("Content-Type", mime) + + if mime == "application/xml" { for k, v := range feedHeaders { w.Header().Add(k, v) }