mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-27 19:17:47 +01:00
Error string should not be capitalized (#14840)
Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
parent
c1f9b14a22
commit
0dfc801a50
@ -115,7 +115,7 @@ func (chc *ChartCache) PutChart(chart *ChartVersionDetails) {
|
||||
}
|
||||
default:
|
||||
// Should not reach here, but still put guard code here
|
||||
err = errors.New("Meet invalid cache driver")
|
||||
err = errors.New("meet invalid cache driver")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@ -126,11 +126,11 @@ func getIndexYaml(path string) (*helm_repo.IndexFile, error) {
|
||||
|
||||
indexFile := &helm_repo.IndexFile{}
|
||||
if err := yaml.Unmarshal(content, indexFile); err != nil {
|
||||
return nil, fmt.Errorf("Unmarshal error: %s", err)
|
||||
return nil, fmt.Errorf("unmarshal error: %s", err)
|
||||
}
|
||||
|
||||
if indexFile == nil {
|
||||
return nil, fmt.Errorf("Got nil index yaml file")
|
||||
return nil, fmt.Errorf("got nil index yaml file")
|
||||
}
|
||||
|
||||
return indexFile, nil
|
||||
|
@ -82,7 +82,7 @@ func (b *BaseAPI) DecodeJSONReq(v interface{}) error {
|
||||
if err != nil {
|
||||
log.Errorf("Error while decoding the json request, error: %v, %v",
|
||||
err, string(b.Ctx.Input.CopyBody(1 << 32)[:]))
|
||||
return errors.New("Invalid json request")
|
||||
return errors.New("invalid json request")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ func addProjectMember(member models.Member) (int, error) {
|
||||
o := GetOrmer()
|
||||
|
||||
if member.EntityID <= 0 {
|
||||
return 0, fmt.Errorf("Invalid entity_id, member: %+v", member)
|
||||
return 0, fmt.Errorf("invalid entity_id, member: %+v", member)
|
||||
}
|
||||
|
||||
if member.ProjectID <= 0 {
|
||||
return 0, fmt.Errorf("Invalid project_id, member: %+v", member)
|
||||
return 0, fmt.Errorf("invalid project_id, member: %+v", member)
|
||||
}
|
||||
|
||||
var pmID int
|
||||
|
@ -81,7 +81,7 @@ func updateUserInitialPassword(userID int, password string) error {
|
||||
queryUser := models.User{UserID: userID}
|
||||
user, err := dao.GetUser(queryUser)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to get user, userID: %d %v", userID, err)
|
||||
return fmt.Errorf("failed to get user, userID: %d %v", userID, err)
|
||||
}
|
||||
if user == nil {
|
||||
return fmt.Errorf("user id: %d does not exist", userID)
|
||||
@ -89,7 +89,7 @@ func updateUserInitialPassword(userID int, password string) error {
|
||||
if user.Salt == "" {
|
||||
err = pkguser.Mgr.UpdatePassword(orm.Context(), userID, password)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to update user encrypted password, userID: %d, err: %v", userID, err)
|
||||
return fmt.Errorf("failed to update user encrypted password, userID: %d, err: %v", userID, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -160,7 +160,7 @@ func (dc *defaultClient) SearchUser(username string) ([]*SearchUserEntry, error)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("Unexpected status code for searching user in UAA: %d, response: %s", resp.StatusCode, string(bytes))
|
||||
return nil, fmt.Errorf("unexpected status code for searching user in UAA: %d, response: %s", resp.StatusCode, string(bytes))
|
||||
}
|
||||
res := &SearchUserRes{}
|
||||
if err := json.Unmarshal(bytes, res); err != nil {
|
||||
|
@ -32,13 +32,13 @@ func (fc *FakeClient) PasswordAuth(username, password string) (*oauth2.Token, er
|
||||
if username == fc.Username && password == fc.Password {
|
||||
return &oauth2.Token{AccessToken: fakeToken}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Invalide username and password")
|
||||
return nil, fmt.Errorf("invalide username and password")
|
||||
}
|
||||
|
||||
// GetUserInfo ...
|
||||
func (fc *FakeClient) GetUserInfo(token string) (*UserInfo, error) {
|
||||
if token != fakeToken {
|
||||
return nil, fmt.Errorf("Unexpected token: %s, expected: %s", token, fakeToken)
|
||||
return nil, fmt.Errorf("unexpected token: %s, expected: %s", token, fakeToken)
|
||||
}
|
||||
info := &UserInfo{
|
||||
Name: "fakeName",
|
||||
|
@ -174,7 +174,7 @@ func (c *controller) Create(ctx context.Context, projectNameOrID interface{}, re
|
||||
|
||||
}
|
||||
if member.EntityID <= 0 {
|
||||
return 0, fmt.Errorf("Can not get valid member entity, request: %+v", req)
|
||||
return 0, fmt.Errorf("can not get valid member entity, request: %+v", req)
|
||||
}
|
||||
|
||||
// Check if member already exist in current project
|
||||
|
@ -117,7 +117,7 @@ func (cra *ChartRepositoryAPI) requireAccess(action rbac.Action, subresource ...
|
||||
func (cra *ChartRepositoryAPI) GetHealthStatus() {
|
||||
// Check access
|
||||
if !cra.SecurityCtx.IsAuthenticated() {
|
||||
cra.SendUnAuthorizedError(errors.New("Unauthorized"))
|
||||
cra.SendUnAuthorizedError(errors.New("unauthorized"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ func (cra *ChartRepositoryAPI) GetIndexByRepo() {
|
||||
func (cra *ChartRepositoryAPI) GetIndex() {
|
||||
// Check access
|
||||
if !cra.SecurityCtx.IsAuthenticated() {
|
||||
cra.SendUnAuthorizedError(errors.New("Unauthorized"))
|
||||
cra.SendUnAuthorizedError(errors.New("unauthorized"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ func (cra *ChartRepositoryAPI) rewriteFileContent(files []formFile, request *htt
|
||||
|
||||
// Handle error case by case
|
||||
if err != nil {
|
||||
formatedErr := fmt.Errorf("Get file content with multipart header from key '%s' failed with error: %s", f.formField, err.Error())
|
||||
formatedErr := fmt.Errorf("get file content with multipart header from key '%s' failed with error: %s", f.formField, err.Error())
|
||||
if f.mustHave || err != http.ErrMissingFile {
|
||||
return formatedErr
|
||||
}
|
||||
@ -582,12 +582,12 @@ func (cra *ChartRepositoryAPI) rewriteFileContent(files []formFile, request *htt
|
||||
|
||||
fw, err := w.CreateFormFile(f.formField, mHeader.Filename)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Create form file with multipart header failed with error: %s", err.Error())
|
||||
return fmt.Errorf("create form file with multipart header failed with error: %s", err.Error())
|
||||
}
|
||||
|
||||
_, err = io.Copy(fw, mFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Copy file stream in multipart form data failed with error: %s", err.Error())
|
||||
return fmt.Errorf("copy file stream in multipart form data failed with error: %s", err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
@ -603,18 +603,18 @@ func (cra *ChartRepositoryAPI) rewriteFileContent(files []formFile, request *htt
|
||||
func initializeChartController() (*chartserver.Controller, error) {
|
||||
addr, err := config.GetChartMuseumEndpoint()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to get the endpoint URL of chart storage server: %s", err.Error())
|
||||
return nil, fmt.Errorf("failed to get the endpoint URL of chart storage server: %s", err.Error())
|
||||
}
|
||||
|
||||
addr = strings.TrimSuffix(addr, "/")
|
||||
url, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, errors.New("Endpoint URL of chart storage server is malformed")
|
||||
return nil, errors.New("endpoint URL of chart storage server is malformed")
|
||||
}
|
||||
|
||||
controller, err := chartserver.NewController(url, orm.Middleware())
|
||||
if err != nil {
|
||||
return nil, errors.New("Failed to initialize chart API controller")
|
||||
return nil, errors.New("failed to initialize chart API controller")
|
||||
}
|
||||
|
||||
hlog.Debugf("Chart storage server is set to %s", url.String())
|
||||
|
@ -36,16 +36,16 @@ const frozenTime time.Duration = 1500 * time.Millisecond
|
||||
var lock = NewUserLock(frozenTime)
|
||||
|
||||
// ErrorUserNotExist ...
|
||||
var ErrorUserNotExist = errors.New("User does not exist")
|
||||
var ErrorUserNotExist = errors.New("user does not exist")
|
||||
|
||||
// ErrorGroupNotExist ...
|
||||
var ErrorGroupNotExist = errors.New("Group does not exist")
|
||||
var ErrorGroupNotExist = errors.New("group does not exist")
|
||||
|
||||
// ErrDuplicateLDAPGroup ...
|
||||
var ErrDuplicateLDAPGroup = errors.New("An LDAP user group with same DN already exist")
|
||||
var ErrDuplicateLDAPGroup = errors.New("a LDAP user group with same DN already exist")
|
||||
|
||||
// ErrInvalidLDAPGroupDN ...
|
||||
var ErrInvalidLDAPGroupDN = errors.New("The LDAP group DN is invalid")
|
||||
var ErrInvalidLDAPGroupDN = errors.New("the LDAP group DN is invalid")
|
||||
|
||||
// ErrNotSupported ...
|
||||
var ErrNotSupported = errors.New("not supported")
|
||||
@ -149,7 +149,7 @@ func Login(m models.AuthModel) (*models.User, error) {
|
||||
|
||||
authenticator, ok := registry[authMode]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Unrecognized auth_mode: %s", authMode)
|
||||
return nil, fmt.Errorf("unrecognized auth_mode: %s", authMode)
|
||||
}
|
||||
if lock.IsLocked(m.Principal) {
|
||||
log.Debugf("%s is locked due to login failure, login failed", m.Principal)
|
||||
@ -175,7 +175,7 @@ func getHelper() (AuthenticateHelper, error) {
|
||||
}
|
||||
AuthenticateHelper, ok := registry[authMode]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Can not get authenticator, authmode: %s", authMode)
|
||||
return nil, fmt.Errorf("can not get authenticator, authmode: %s", authMode)
|
||||
}
|
||||
return AuthenticateHelper, nil
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ func (a *Auth) SearchGroup(groupKey string) (*model.UserGroup, error) {
|
||||
func (a *Auth) OnBoardGroup(u *model.UserGroup, altGroupName string) error {
|
||||
// if group name provided, on board the user group
|
||||
if len(u.GroupName) == 0 {
|
||||
return errors.New("Should provide a group name")
|
||||
return errors.New("should provide a group name")
|
||||
}
|
||||
u.GroupType = common.HTTPGroupType
|
||||
err := usergroup.Ctl.Ensure(orm.Context(), u)
|
||||
|
@ -115,7 +115,7 @@ func (u *Auth) SearchUser(username string) (*models.User, error) {
|
||||
return nil, nil
|
||||
}
|
||||
if len(l) > 1 {
|
||||
return nil, fmt.Errorf("Multiple entries found for username: %s", username)
|
||||
return nil, fmt.Errorf("multiple entries found for username: %s", username)
|
||||
}
|
||||
e := l[0]
|
||||
email := ""
|
||||
|
@ -70,7 +70,7 @@ func updateInitPassword(ctx context.Context, userID int, password string) error
|
||||
queryUser := models.User{UserID: userID}
|
||||
user, err := dao.GetUser(queryUser)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to get user, userID: %d %v", userID, err)
|
||||
return fmt.Errorf("failed to get user, userID: %d %v", userID, err)
|
||||
}
|
||||
if user == nil {
|
||||
return fmt.Errorf("user id: %d does not exist", userID)
|
||||
@ -78,7 +78,7 @@ func updateInitPassword(ctx context.Context, userID int, password string) error
|
||||
if user.Salt == "" {
|
||||
err = ctluser.Ctl.UpdatePassword(ctx, userID, password)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to update user encrypted password, userID: %d, err: %v", userID, err)
|
||||
return fmt.Errorf("failed to update user encrypted password, userID: %d, err: %v", userID, err)
|
||||
}
|
||||
|
||||
log.Infof("User id: %d updated its encrypted password successfully.", userID)
|
||||
|
@ -111,10 +111,10 @@ type endpointParser struct {
|
||||
func (e endpointParser) parse(s string) (*image, error) {
|
||||
repo := strings.SplitN(s, "/", 2)
|
||||
if len(repo) < 2 {
|
||||
return nil, fmt.Errorf("Unable to parse image from string: %s", s)
|
||||
return nil, fmt.Errorf("unable to parse image from string: %s", s)
|
||||
}
|
||||
if repo[0] != e.endpoint {
|
||||
return nil, fmt.Errorf("Mismatch endpoint from string: %s, expected endpoint: %s", s, e.endpoint)
|
||||
return nil, fmt.Errorf("mismatch endpoint from string: %s, expected endpoint: %s", s, e.endpoint)
|
||||
}
|
||||
return parseImg(repo[1])
|
||||
}
|
||||
@ -123,7 +123,7 @@ func (e endpointParser) parse(s string) (*image, error) {
|
||||
func parseImg(s string) (*image, error) {
|
||||
repo := strings.SplitN(s, "/", 2)
|
||||
if len(repo) < 2 {
|
||||
return nil, fmt.Errorf("Unable to parse image from string: %s", s)
|
||||
return nil, fmt.Errorf("unable to parse image from string: %s", s)
|
||||
}
|
||||
i := strings.SplitN(repo[1], ":", 2)
|
||||
res := &image{
|
||||
@ -148,7 +148,7 @@ func (reg registryFilter) filter(ctx context.Context, ctl project.Controller,
|
||||
a *token.ResourceActions) error {
|
||||
// Do not filter if the request is to access registry catalog
|
||||
if a.Name != "catalog" {
|
||||
return fmt.Errorf("Unable to handle, type: %s, name: %s", a.Type, a.Name)
|
||||
return fmt.Errorf("unable to handle, type: %s, name: %s", a.Type, a.Name)
|
||||
}
|
||||
|
||||
secCtx, ok := security.FromContext(ctx)
|
||||
|
@ -42,7 +42,7 @@ func (s StatusRespHandler) Handle(resp *http.Response) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("Unexpected status code: %d, text: %s", resp.StatusCode, string(b))
|
||||
return fmt.Errorf("unexpected status code: %d, text: %s", resp.StatusCode, string(b))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func New() DAO {
|
||||
func (d *dao) GetProjectMember(ctx context.Context, queryMember models.Member, query *q.Query) ([]*models.Member, error) {
|
||||
log.Debugf("Query condition %+v", queryMember)
|
||||
if queryMember.ProjectID == 0 {
|
||||
return nil, fmt.Errorf("Failed to query project member, query condition %v", queryMember)
|
||||
return nil, fmt.Errorf("failed to query project member, query condition %v", queryMember)
|
||||
}
|
||||
o, err := orm.FromContext(ctx)
|
||||
if err != nil {
|
||||
@ -139,11 +139,11 @@ func (d *dao) AddProjectMember(ctx context.Context, member models.Member) (int,
|
||||
}
|
||||
|
||||
if member.EntityID <= 0 {
|
||||
return 0, fmt.Errorf("Invalid entity_id, member: %+v", member)
|
||||
return 0, fmt.Errorf("invalid entity_id, member: %+v", member)
|
||||
}
|
||||
|
||||
if member.ProjectID <= 0 {
|
||||
return 0, fmt.Errorf("Invalid project_id, member: %+v", member)
|
||||
return 0, fmt.Errorf("invalid project_id, member: %+v", member)
|
||||
}
|
||||
|
||||
delSQL := "delete from project_member where project_id = ? and entity_id = ? and entity_type = ? "
|
||||
|
@ -68,11 +68,11 @@ func NewNotificationWatcher() *NotificationWatcher {
|
||||
// Handle the related topic with the specified handler.
|
||||
func (nw *NotificationWatcher) Handle(topic string, handler NotificationHandler) error {
|
||||
if strings.TrimSpace(topic) == "" {
|
||||
return errors.New("Empty topic is not supported")
|
||||
return errors.New("empty topic is not supported")
|
||||
}
|
||||
|
||||
if handler == nil {
|
||||
return errors.New("Nil handler can not be registered")
|
||||
return errors.New("nil handler can not be registered")
|
||||
}
|
||||
|
||||
defer nw.Unlock()
|
||||
@ -81,7 +81,7 @@ func (nw *NotificationWatcher) Handle(topic string, handler NotificationHandler)
|
||||
t := reflect.TypeOf(handler).String()
|
||||
if indexer, ok := nw.handlers[topic]; ok {
|
||||
if _, existing := indexer[t]; existing {
|
||||
return fmt.Errorf("Topic %s has already register the handler with type %s", topic, t)
|
||||
return fmt.Errorf("topic %s has already register the handler with type %s", topic, t)
|
||||
}
|
||||
|
||||
indexer[t] = handler
|
||||
@ -109,7 +109,7 @@ func (nw *NotificationWatcher) Handle(topic string, handler NotificationHandler)
|
||||
// then revoke the whole topic, otherwise only revoke the specified handler.
|
||||
func (nw *NotificationWatcher) UnHandle(topic string, handler string) error {
|
||||
if strings.TrimSpace(topic) == "" {
|
||||
return errors.New("Empty topic is not supported")
|
||||
return errors.New("empty topic is not supported")
|
||||
}
|
||||
|
||||
defer nw.Unlock()
|
||||
@ -156,13 +156,13 @@ func (nw *NotificationWatcher) UnHandle(topic string, handler string) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("Failed to revoke handler %s with topic %s", handler, topic)
|
||||
return fmt.Errorf("failed to revoke handler %s with topic %s", handler, topic)
|
||||
}
|
||||
|
||||
// Notify that notification is coming.
|
||||
func (nw *NotificationWatcher) Notify(notification Notification) error {
|
||||
if strings.TrimSpace(notification.Topic) == "" {
|
||||
return errors.New("Empty topic can not be notified")
|
||||
return errors.New("empty topic can not be notified")
|
||||
}
|
||||
|
||||
defer nw.RUnlock()
|
||||
@ -174,7 +174,7 @@ func (nw *NotificationWatcher) Notify(notification Notification) error {
|
||||
handlers = []NotificationHandler{}
|
||||
)
|
||||
if indexer, ok = nw.handlers[notification.Topic]; !ok {
|
||||
return fmt.Errorf("No handlers registered for handling topic %s", notification.Topic)
|
||||
return fmt.Errorf("no handlers registered for handling topic %s", notification.Topic)
|
||||
}
|
||||
|
||||
for _, h := range indexer {
|
||||
|
@ -42,7 +42,7 @@ func getRegion(url string) (region string, err error) {
|
||||
}
|
||||
rs := regRegion.FindStringSubmatch(url)
|
||||
if rs == nil {
|
||||
return "", errors.New("Invalid Rgistry|CR service url")
|
||||
return "", errors.New("invalid Rgistry|CR service url")
|
||||
}
|
||||
// fmt.Println(rs)
|
||||
return rs[2], nil
|
||||
@ -292,7 +292,7 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) (resources []*model.Re
|
||||
var tags []string
|
||||
tags, err = a.getTags(repo, client)
|
||||
if err != nil {
|
||||
return fmt.Errorf("List tags for repo '%s' error: %v", repo.RepoName, err)
|
||||
return fmt.Errorf("list tags for repo '%s' error: %v", repo.RepoName, err)
|
||||
}
|
||||
|
||||
var filterTags []string
|
||||
@ -301,7 +301,7 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) (resources []*model.Re
|
||||
var ok bool
|
||||
ok, err = util.Match(tagsPattern, tag)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Match tag '%s' error: %v", tag, err)
|
||||
return fmt.Errorf("match tag '%s' error: %v", tag, err)
|
||||
}
|
||||
if ok {
|
||||
filterTags = append(filterTags, tag)
|
||||
|
@ -22,7 +22,7 @@ const (
|
||||
)
|
||||
|
||||
// ErrHTTPNotFound defines the return error when receiving 404 response code
|
||||
var ErrHTTPNotFound = errors.New("Not Found")
|
||||
var ErrHTTPNotFound = errors.New("not found")
|
||||
|
||||
func searchPackages(kind, offset, limit int, queryString string) string {
|
||||
if len(queryString) == 0 {
|
||||
|
@ -64,7 +64,7 @@ func newAdapter(registry *model.Registry) (*adapter, error) {
|
||||
func parseRegion(url string) (string, error) {
|
||||
rs := regionRegexp.FindStringSubmatch(url)
|
||||
if rs == nil {
|
||||
return "", errors.New("Bad aws url")
|
||||
return "", errors.New("bad aws url")
|
||||
}
|
||||
return rs[1], nil
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ var urlForBenchmark = []string{
|
||||
func compileRegexpEveryTime(url string) (string, error) {
|
||||
rs := regexp.MustCompile(regionPattern).FindStringSubmatch(url)
|
||||
if rs == nil {
|
||||
return "", errors.New("Bad aws url")
|
||||
return "", errors.New("bad aws url")
|
||||
}
|
||||
return rs[1], nil
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ func (a *adapter) PrepareForPush(resources []*model.Resource) error {
|
||||
func (a *adapter) listArtifacts(repository string, filters []*model.Filter) ([]*model.Artifact, error) {
|
||||
tags, err := a.clientDTRAPI.getTags(repository)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("List tags for repo '%s' error: %v", repository, err)
|
||||
return nil, fmt.Errorf("list tags for repo '%s' error: %v", repository, err)
|
||||
}
|
||||
var artifacts []*model.Artifact
|
||||
for _, tag := range tags {
|
||||
|
@ -130,7 +130,7 @@ func (a *adapter) FetchArtifacts(filters []*model.Filter) (resources []*model.Re
|
||||
if paths, ok := util.IsSpecificPath(pattern); ok {
|
||||
repositories = paths
|
||||
} else {
|
||||
err = errors.New("Only support specific repository name")
|
||||
err = errors.New("only support specific repository name")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ func (bc *basicClient) GetCandidates(repository *selector.Repository) ([]*select
|
||||
}
|
||||
for _, art := range artifacts {
|
||||
if art.Digest == "" {
|
||||
return nil, fmt.Errorf("Lack Digest of Candidate for %s/%s", repository.Namespace, repository.Name)
|
||||
return nil, fmt.Errorf("lack digest of candidate for %s/%s", repository.Namespace, repository.Name)
|
||||
}
|
||||
labels := make([]string, 0)
|
||||
for _, label := range art.Labels {
|
||||
|
@ -18,13 +18,13 @@ type Claim struct {
|
||||
// Valid valid the claims "tokenID, projectID and access".
|
||||
func (rc Claim) Valid() error {
|
||||
if rc.TokenID < 0 {
|
||||
return errors.New("Token id must an valid INT")
|
||||
return errors.New("token id must an valid INT")
|
||||
}
|
||||
if rc.ProjectID < 0 {
|
||||
return errors.New("Project id must an valid INT")
|
||||
return errors.New("project id must an valid INT")
|
||||
}
|
||||
if rc.Access == nil {
|
||||
return errors.New("The access info cannot be nil")
|
||||
return errors.New("the access info cannot be nil")
|
||||
}
|
||||
stdErr := rc.StandardClaims.Valid()
|
||||
if stdErr != nil {
|
||||
|
@ -104,7 +104,7 @@ func (c *client) StartGC() (*gc.Result, error) {
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Errorf("Failed to start gc: %d", resp.StatusCode)
|
||||
return nil, fmt.Errorf("Failed to start GC: %d", resp.StatusCode)
|
||||
return nil, fmt.Errorf("failed to start GC: %d", resp.StatusCode)
|
||||
}
|
||||
if err := json.Unmarshal(data, gcr); err != nil {
|
||||
return nil, err
|
||||
|
@ -208,7 +208,7 @@ func (suite *RequestMiddlewareTestSuite) TestResourcesRequestDenied() {
|
||||
|
||||
mock.OnAnything(suite.quotaController, "IsEnabled").Return(true, nil)
|
||||
var errs pquota.Errors
|
||||
errs = errs.Add(fmt.Errorf("Exceed"))
|
||||
errs = errs.Add(fmt.Errorf("exceed"))
|
||||
mock.OnAnything(suite.quotaController, "Request").Return(errs)
|
||||
|
||||
RequestMiddleware(config)(next).ServeHTTP(rr, req)
|
||||
|
@ -233,7 +233,7 @@ func proxyManifestHead(ctx context.Context, w http.ResponseWriter, ctl proxy.Con
|
||||
return err
|
||||
}
|
||||
if !exist || desc == nil {
|
||||
return errors.NotFoundError(fmt.Errorf("The tag %v:%v is not found", art.Repository, art.Tag))
|
||||
return errors.NotFoundError(fmt.Errorf("the tag %v:%v is not found", art.Repository, art.Tag))
|
||||
}
|
||||
go func(art lib.ArtifactInfo) {
|
||||
// After docker 20.10 or containerd, the client heads the tag first,
|
||||
|
Loading…
Reference in New Issue
Block a user