Skip to content

Commit

Permalink
Improve wording of error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneMPutnam committed Jun 14, 2024
1 parent 9ef1910 commit e93254e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blobstore/blobhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func (bh *BlobHandler) GetS3ReadPermissions(c echo.Context, bucket string) ([]st
return nil, false, http.StatusInternalServerError, fmt.Errorf("error fetching user permissions: %s", err.Error())
}
if !fullAccess && len(permissions) == 0 {
return nil, false, http.StatusForbidden, fmt.Errorf("user does not have read permission to read the %s bucket", bucket)
return nil, false, http.StatusForbidden, fmt.Errorf("user does not have permission to read the %s bucket", bucket)
}
return permissions, fullAccess, http.StatusOK, nil
}
Expand Down
6 changes: 3 additions & 3 deletions blobstore/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (bh *BlobHandler) HandleGetSize(c echo.Context) error {
return c.JSON(statusCode, err.Error())
}
if !fullAccess && !IsPermittedPrefix(bucket, prefix, permissions) {
errMsg := fmt.Errorf("user does not have read permission to read this prefix %s", prefix)
errMsg := fmt.Errorf("user does not have permission to read the %s prefix", prefix)
log.Error(errMsg.Error())
return c.JSON(http.StatusForbidden, errMsg.Error())
}
Expand Down Expand Up @@ -119,7 +119,7 @@ func (bh *BlobHandler) HandleGetMetaData(c echo.Context) error {
}

if !fullAccess && !IsPermittedPrefix(bucket, key, permissions) {
errMsg := fmt.Errorf("user does not have read permission to read this key %s", key)
errMsg := fmt.Errorf("user does not have permission to read the %s key", key)
log.Error(errMsg.Error())
return c.JSON(http.StatusForbidden, errMsg.Error())
}
Expand Down Expand Up @@ -162,7 +162,7 @@ func (bh *BlobHandler) HandleGetObjExist(c echo.Context) error {
}

if !fullAccess && !IsPermittedPrefix(bucket, key, permissions) {
errMsg := fmt.Errorf("user does not have read permission to read this key %s", key)
errMsg := fmt.Errorf("user does not have permission to read the %s key", key)
log.Error(errMsg.Error())
return c.JSON(http.StatusForbidden, errMsg.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion blobstore/object_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (bh *BlobHandler) HandleObjectContents(c echo.Context) error {
}

if !fullAccess && !IsPermittedPrefix(bucket, key, permissions) {
errMsg := fmt.Errorf("user does not have read permission to read this key %s", key)
errMsg := fmt.Errorf("user does not have permission to read the %s key", key)
log.Error(errMsg.Error())
return c.JSON(http.StatusForbidden, errMsg.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion blobstore/presigned_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (bh *BlobHandler) HandleGetPresignedDownloadURL(c echo.Context) error {
}

if !fullAccess && !IsPermittedPrefix(bucket, key, permissions) {
errMsg := fmt.Errorf("user does not have read permission to read this key %s", key)
errMsg := fmt.Errorf("user does not have permission to read the %s key", key)
log.Error(errMsg.Error())
return c.JSON(http.StatusForbidden, errMsg.Error())
}
Expand Down

0 comments on commit e93254e

Please sign in to comment.