Handle unauthorized error

Signed-off-by: Emily Casey <emily.casey@docker.com>
This commit is contained in:
Emily Casey 2025-04-17 17:52:34 -04:00
parent fdf81fe571
commit 43fdb4cd50
1 changed files with 5 additions and 0 deletions

View File

@ -368,6 +368,11 @@ func (m *Manager) handlePushModel(w http.ResponseWriter, r *http.Request, model
http.Error(w, "Model not found", http.StatusNotFound)
return
}
if errors.Is(err, distribution.ErrUnauthorized) {
m.log.Warnf("Failed to push model %q: %v", model, err)
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}