mirror of
https://github.com/distribution/distribution.git
synced 2026-10-28 10:15:27 +08:00
fix(tags): return empty array after final pagination marker
Signed-off-by: Joonas Bergius <joonas@defenseunicorns.com>
This commit is contained in:
2 files changed
+10
-2
No files matched your search
@@ -546,6 +546,12 @@ func TestTagsAPI(t *testing.T) {
|
||||
"sb71y",
|
||||
}},
|
||||
},
|
||||
{
|
||||
name: "page after last tag",
|
||||
queryParams: url.Values{"last": []string{"sb71y"}, "n": []string{"1"}},
|
||||
expectedStatusCode: http.StatusOK,
|
||||
expectedBody: tagsAPIResponse{Name: imageName.Name(), Tags: []string{}},
|
||||
},
|
||||
{
|
||||
name: "page size bigger than full list",
|
||||
queryParams: url.Values{"n": []string{"100"}},
|
||||
@@ -601,7 +607,7 @@ func TestTagsAPI(t *testing.T) {
|
||||
t.Fatalf("unexpected error decoding response body: %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(body, test.expectedBody) {
|
||||
t.Fatalf("expected response body to be:\n%+v\ngot:\n%+v", test.expectedBody, body)
|
||||
t.Fatalf("expected response body to be:\n%#v\ngot:\n%#v", test.expectedBody, body)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,9 @@ func (th *tagsHandler) GetTags(w http.ResponseWriter, r *http.Request) {
|
||||
// err is either io.EOF
|
||||
moreEntries = false
|
||||
}
|
||||
filled = returnedTags
|
||||
if returnedTags != nil {
|
||||
filled = returnedTags
|
||||
}
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
Reference in new issue
Block a user