Skip to content

Commit 9586596

Browse files
committed
fix: address changes requested by @vknabel
1 parent cfe5e20 commit 9586596

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

cmd/metal-api/internal/service/image-service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,20 +358,20 @@ func checkImageURL(id, inputURL string, ociCredentials authn.Authenticator) erro
358358
case "http", "https":
359359
_, err := url.ParseRequestURI(inputURL)
360360
if err != nil {
361-
return fmt.Errorf("image:%s could not be parsed. error:%w", inputURL, err)
361+
return fmt.Errorf("image:%q could not be parsed, error:%w", inputURL, err)
362362
}
363363

364364
res, err := http.Head(inputURL)
365365
if err != nil {
366-
return fmt.Errorf("image:%s is not accessible under:%s error:%w", id, inputURL, err)
366+
return fmt.Errorf("image:%q is not accessible under:%s, error:%w", id, inputURL, err)
367367
}
368368
if res.StatusCode >= 400 {
369-
return fmt.Errorf("image:%s is not accessible under:%s status:%s", id, inputURL, res.Status)
369+
return fmt.Errorf("image:%q is not accessible under:%s, status:%s", id, inputURL, res.Status)
370370
}
371371
case "oci":
372372
ref, err := name.ParseReference(parsedURL[1])
373373
if err != nil {
374-
return fmt.Errorf("image reference:%s could not be parsed. error:%w", inputURL, err)
374+
return fmt.Errorf("image reference:%q could not be parsed, error:%w", inputURL, err)
375375
}
376376

377377
if ociCredentials == nil {
@@ -380,10 +380,10 @@ func checkImageURL(id, inputURL string, ociCredentials authn.Authenticator) erro
380380

381381
_, err = remote.Image(ref, remote.WithAuth(ociCredentials))
382382
if err != nil {
383-
return fmt.Errorf("image:%s is not accessible under:%s error:%w", id, inputURL, err)
383+
return fmt.Errorf("image:%q is not accessible under:%s, error:%w", id, inputURL, err)
384384
}
385385
default:
386-
return fmt.Errorf("image:%s with url:%s has unkown protocol", id, inputURL)
386+
return fmt.Errorf("image:%q with url:%s has unknown protocol", id, inputURL)
387387
}
388388

389389
return nil

0 commit comments

Comments
 (0)