From 0523607f692365b4ce0f9c54ba3af69a8f8b8d62 Mon Sep 17 00:00:00 2001 From: Sinuhe Tellez Date: Fri, 24 Mar 2017 01:26:55 -0400 Subject: [PATCH] the link type should have the kind --- main.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 04c9fa3..0b1f84e 100644 --- a/main.go +++ b/main.go @@ -42,7 +42,6 @@ type AcquisitionFeed struct { type CatalogFeed atom.Feed -const catalogType = "application/atom+xml;profile=opds-catalog" const acquisitionType = "application/atom+xml;profile=opds-catalog;kind=acquisition" const navegationType = "application/atom+xml;profile=opds-catalog;kind=navigation" @@ -130,17 +129,11 @@ func writeCatalogFeed(w io.Writer, u *url.URL) error { } for _, fi := range fis { - isAcquisition, _ := isAcquisitionFeed(filepath.Join(abs_path, fi.Name())) - - var linkType string - if linkType = catalogType; isAcquisition { - linkType = acquisitionType - } link := atom.Link{ Rel: "subsection", Title: fi.Name(), Href: filepath.Join(u.EscapedPath(), url.PathEscape(fi.Name())), - Type: linkType, + Type: acquisitionType, } entry := &atom.Entry{ ID: filepath.Join(u.Path, fi.Name()), @@ -169,7 +162,7 @@ func writeAcquisitionFeed(w io.Writer, u *url.URL) error { feed.Link = []atom.Link{{ Rel: "start", Href: "/", - Type: "application/atom+xml;profile=opds-catalog;kind=navigation", + Type: navegationType, }} abs_path := filepath.Join(dirRoot, u.Path) @@ -191,6 +184,7 @@ func writeAcquisitionFeed(w io.Writer, u *url.URL) error { rel = "http://opds-spec.org/image/thumbnail" } link := atom.Link{ + Title: fi.Name(), Rel: rel, Type: mime_type, Href: filepath.Join(u.EscapedPath(), url.PathEscape(fi.Name())),