all repos — homestead @ 05be0fdbdfbbc455317c909f5f8fa4f441235a74

Code for my website

enable custom headers for feeds (allow fetch from remote sites)

Alan Pearce
commit

05be0fdbdfbbc455317c909f5f8fa4f441235a74

parent

52549c0ea610306039e1f3f91c89e05ba4f41e72

1 file changed, 10 insertions(+), 0 deletions(-)

changed files
M internal/storage/sqlite/writer.gointernal/storage/sqlite/writer.go
@@ -3,6 +3,7 @@
import ( "context" "database/sql" + "encoding/json" "fmt" "hash/fnv" "io"
@@ -106,6 +107,15 @@ LastModified: file.LastModified.Unix(),
Etag: file.Etag, StyleHash: file.StyleHash, Title: file.Title, + Headers: []byte{}, + } + if file.Headers != nil { + jso, err := json.Marshal(file.Headers) + if err != nil { + return 0, fault.Wrap(err, fmsg.With("marshalling headers to JSON")) + } + params.Headers = jso + s.log.Info("storing file", "file", file.Path, "headers", params.Headers) } id, err := s.queries.InsertFile(context.TODO(), params) if err != nil {