mirror of
https://github.com/imjasonh/kontain.me
synced 2026-07-22 15:51:12 +00:00
remove unnecessary /ko/ path element
This commit is contained in:
parent
5fc6219f0c
commit
464dd7e8ae
3 changed files with 14 additions and 23 deletions
|
|
@ -8,13 +8,10 @@ import (
|
|||
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotFound = errors.New("repository or commit not found")
|
||||
ErrInvalid = errors.New("requested manifest is invalid")
|
||||
)
|
||||
var ErrNotFound = errors.New("repository or commit not found")
|
||||
|
||||
func Error(w http.ResponseWriter, err error) {
|
||||
code := "INTERNAL_ERROR"
|
||||
code := "MANIFEST_UNKNOWN"
|
||||
httpCode := http.StatusNotFound
|
||||
if terr, ok := err.(*transport.Error); ok {
|
||||
http.Error(w, "", terr.StatusCode)
|
||||
|
|
@ -22,13 +19,6 @@ func Error(w http.ResponseWriter, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
if err == ErrNotFound {
|
||||
code = "MANIFEST_UNKNOWN"
|
||||
} else if err == ErrInvalid {
|
||||
code = "NAME_INVALID"
|
||||
httpCode = http.StatusBadRequest
|
||||
}
|
||||
|
||||
http.Error(w, "", httpCode)
|
||||
json.NewEncoder(w).Encode(&resp{
|
||||
Errors: []e{{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue