File tree 1 file changed +21
-4
lines changed
1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 1
1
package registry
2
2
3
- import "context"
3
+ import (
4
+ "context"
5
+ "net/url"
6
+
7
+ "github.com/peterhellberg/link"
8
+ )
4
9
5
10
type tagsResponse struct {
6
11
Tags []string `json:"tags"`
7
12
}
8
13
9
14
// Tags returns the tags for a specific repository.
10
15
func (r * Registry ) Tags (ctx context.Context , repository string ) ([]string , error ) {
11
- url := r .url ("/v2/%s/tags/list" , repository )
12
- r .Logf ("registry.tags url=%s repository=%s" , url , repository )
16
+ u := r .url ("/v2/%s/tags/list" , repository )
17
+ r .Logf ("registry.tags url=%s repository=%s" , u , repository )
13
18
14
19
var response tagsResponse
15
- if _ , err := r .getJSON (ctx , url , & response ); err != nil {
20
+ h , err := r .getJSON (ctx , u , & response )
21
+ if err != nil {
16
22
return nil , err
17
23
}
18
24
25
+ for _ , l := range link .ParseHeader (h ) {
26
+ if l .Rel == "next" {
27
+ unescaped , _ := url .QueryUnescape (l .URI )
28
+ tags , err := r .Catalog (ctx , unescaped )
29
+ if err != nil {
30
+ return nil , err
31
+ }
32
+ response .Tags = append (response .Tags , tags ... )
33
+ }
34
+ }
35
+
19
36
return response .Tags , nil
20
37
}
You can’t perform that action at this time.
0 commit comments