Skip to content

Commit 0a4dded

Browse files
committed
fix(proxy): fix proxying non-default registries
1 parent a11111c commit 0a4dded

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/proxy/proxy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func parseWwwAuthenticate(wwwAuthenticate string) map[string]string {
2626
return opts
2727
}
2828

29-
func proxyRegistry(c *gin.Context, endpoint string, image string, httpToError bool) error {
29+
func proxyRegistry(c *gin.Context, endpoint string, image string, localCache bool) error {
3030
klog.V(2).InfoS("proxying registry", "endpoint", endpoint, "image", image)
3131

3232
remote, err := url.Parse(endpoint)
@@ -36,7 +36,7 @@ func proxyRegistry(c *gin.Context, endpoint string, image string, httpToError bo
3636

3737
parts := strings.Split(image, "/")
3838
originRegistry := ""
39-
if len(parts) > 2 {
39+
if localCache && len(parts) > 2 {
4040
originRegistry = parts[0] + "/"
4141
image = strings.Join(parts[1:], "/")
4242
} else {
@@ -66,7 +66,7 @@ func proxyRegistry(c *gin.Context, endpoint string, image string, httpToError bo
6666
}
6767

6868
proxy.ModifyResponse = func(resp *http.Response) error {
69-
if httpToError && resp.StatusCode != http.StatusOK {
69+
if localCache && resp.StatusCode != http.StatusOK {
7070
return errors.New(resp.Status)
7171
}
7272
return nil

0 commit comments

Comments
 (0)