Fix reverse boltdb list and tests

master
Bel LaPointe 2018-10-11 08:19:49 -06:00
parent c4d3b24e5c
commit c32ef6c099
4 changed files with 14 additions and 9 deletions

View File

@ -107,7 +107,7 @@ func (feed *Feed) fromGofeed(gofeed *gofeed.Feed) ([]*Item, error) {
if err != nil {
return nil, err
}
feed.Updated = time.Now().UTC() //*updated
feed.Updated = *updated //time.Now().UTC() //*updated
feed.Title = gofeed.Title
return newitems, nil
}

View File

@ -22,7 +22,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: `<img src="A"/><br><img src="asdf"/>`,
Content: `<a href="b">a</a><br><img src="A"/><br><img src="asdf"/>`,
},
},
{
@ -35,7 +35,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: `<img src="asdf"/>`,
Content: `<a href="b">a</a><br><img src="asdf"/>`,
},
},
{
@ -48,7 +48,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: "",
Content: `<a href="b">a</a><br>`,
},
},
{
@ -61,7 +61,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: `<img src="asdf"/>`,
Content: `<a href="b">a</a><br><img src="asdf"/>`,
},
},
{
@ -74,7 +74,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: "x<br>y",
Content: `<a href="b">a</a><br>x<br>y`,
},
},
}

View File

@ -96,8 +96,12 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
case "tag":
s.getFeedTag(w, r)
default:
r.URL.Path = v + "/" + r.URL.Path
s.getFeed(w, r)
if v == "" {
s.bad(w, r)
} else {
r.URL.Path = v + "/" + r.URL.Path
s.getFeed(w, r)
}
}
case "POST":
s.newFeed(w, r)

View File

@ -48,7 +48,8 @@ func (bc *BoltClient) List(namespace, key string, asc bool, limit int) ([]string
found = append(found, string(k))
}
} else {
for k, _ := c.Seek([]byte(key)); k != nil && len(found) < limit; k, _ = c.Next() {
key += "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
for k, _ := c.Seek([]byte(key)); k != nil && len(found) < limit; k, _ = c.Prev() {
found = append(found, string(k))
}
}