1
0
Fork 0
forked from forgejo/forgejo

Fix handling of plenty Nuget package versions (#26075)

Fixes #25953

- Do not load full version information (v3)
- Add pagination support (v2)
This commit is contained in:
KN4CK3R 2023-07-26 21:43:21 +02:00 committed by GitHub
parent 6ce89883eb
commit 2d7fe4cc1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 138 additions and 38 deletions

View file

@ -289,7 +289,7 @@ type FeedResponse struct {
ID string `xml:"id"`
Title TypedValue[string] `xml:"title"`
Updated time.Time `xml:"updated"`
Link FeedEntryLink `xml:"link"`
Links []FeedEntryLink `xml:"link"`
Entries []*FeedEntry `xml:"entry"`
Count int64 `xml:"m:count"`
}
@ -300,6 +300,16 @@ func createFeedResponse(l *linkBuilder, totalEntries int64, pds []*packages_mode
entries = append(entries, createEntry(l, pd, false))
}
links := []FeedEntryLink{
{Rel: "self", Href: l.Base},
}
if l.Next != nil {
links = append(links, FeedEntryLink{
Rel: "next",
Href: l.GetNextURL(),
})
}
return &FeedResponse{
Xmlns: "http://www.w3.org/2005/Atom",
Base: l.Base,
@ -307,7 +317,7 @@ func createFeedResponse(l *linkBuilder, totalEntries int64, pds []*packages_mode
XmlnsM: "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
ID: "http://schemas.datacontract.org/2004/07/",
Updated: time.Now(),
Link: FeedEntryLink{Rel: "self", Href: l.Base},
Links: links,
Count: totalEntries,
Entries: entries,
}