Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
Signed-off-by: wangxiaoxuan273 <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Jan 20, 2023
1 parent bab3579 commit 40cd89f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions registry/handlers/referrers.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (h *referrersHandler) GetReferrers(w http.ResponseWriter, r *http.Request)
// only 1 page of results left
referrers = referrers[startIndex:]
} else {
referrers = referrers[startIndex:(startIndex + pageSize)]
referrers = referrers[startIndex : startIndex+pageSize]
w.Header().Set("Link", generateLinkHeader(h.Repository.Named().Name(), h.Digest.String(), artifactTypeFilter, pageSize, pageNumber+1))
}

Expand Down Expand Up @@ -229,10 +229,10 @@ func readlink(ctx context.Context, path string, stDriver driver.StorageDriver) (
return digest.Parse(string(content))
}

func generateLinkHeader(repoName, subjectDigest, artifactType string, pageSize int, p int) string {
func generateLinkHeader(repoName, subjectDigest, artifactType string, pageSize int, pageNumber int) string {
linkURL := fmt.Sprintf("/v2/%s/referrers/%s", repoName, subjectDigest)
v := url.Values{}
v.Add("p", strconv.Itoa(p))
v.Add("p", strconv.Itoa(pageNumber))
if artifactType != "" {
v.Add("artifactType", artifactType)
}
Expand Down

0 comments on commit 40cd89f

Please sign in to comment.