Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Error Msg For Bucket Names that Contain non-LOWERCASE chars (#2134) #2135

Merged
merged 1 commit into from
Apr 22, 2017

Conversation

badscooter23
Copy link
Contributor

Improved the error message for various mc commands where the user specifies a path or url and the bucket name in that path contains non-lowercase characters.

More specifically, this applies when the path refers to a backend that is an S3 object store and is going through the S3-client. If the backend is a normal/local file system that follows a different path.

The change is in the function isValidBucketName in cmd/client-s3.go. This routine is invoked when validating the path for mb command (as noted in the problem description) but is also used to validate the bucket name for other mc commands (eg: mc events).

Examples:
Scotts-MacBook-Pro-2:mc scott$ mc mb myminio/GoPro
mc: Unable to make bucket myminio/GoPro. Bucket names can contain lowercase alpha characters a-z, numbers '0-9', and '-'. First character cannot be a '-'
Scotts-MacBook-Pro-2:mc scott$ mc events list myminio/GoPro
mc: Cannot enable notification on the specified bucket. Bucket names can contain lowercase alpha characters a-z, numbers '0-9', and '-'. First character cannot be a '-'
Scotts-MacBook-Pro-2:mc scott$

Note: some mc commands (such as ls and share) will report other errors in this same case... We may need to look at these cases as well for consistency.

Scotts-MacBook-Pro-2:mc scott$ mc ls myminio/GoPro
mc: Unable to stat myminio/GoPro. Bucket name contains invalid characters.
Scotts-MacBook-Pro-2:mc scott$ mc share download myminio/GoPro
mc: Unable to stat myminio/GoPro. Bucket name contains invalid characters.
Scotts-MacBook-Pro-2:mc scott$

@codecov-io
Copy link

codecov-io commented Apr 19, 2017

Codecov Report

Merging #2135 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2135   +/-   ##
======================================
  Coverage    8.51%   8.51%           
======================================
  Files          91      91           
  Lines        6809    6809           
======================================
  Hits          580     580           
  Misses       6094    6094           
  Partials      135     135
Impacted Files Coverage Δ
cmd/client-s3.go 14.2% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bdb7af...d4f2e0a. Read the comment docs.

@badscooter23
Copy link
Contributor Author

@harshavardhana Why did my PR fail the codecov/patch test?
Is there something I need to do to fix this and complete the merge?

@harshavardhana
Copy link
Member

codecov/patch failure can be ignored for mc for now. We need to up the coverage on each PR. What it is says that you haven't added anything to cover the changes which were submitted in this PR.

@badscooter23
Copy link
Contributor Author

badscooter23 commented Apr 20, 2017 via email

@harshavardhana
Copy link
Member

But I didn't add any paths either... just changed a message... :)

If you want full green add a test to check for the change in the message.

@harshavardhana harshavardhana requested a review from vadmeste April 20, 2017 21:35
cmd/client-s3.go Outdated
@@ -746,7 +746,7 @@ func isValidBucketName(bucketName string) *probe.Error {
return probe.NewError(errors.New("Bucket name should be more than 3 characters and less than 64 characters"))
}
if !validBucketName.MatchString(bucketName) {
return probe.NewError(errors.New("Bucket name can contain alphabet, '-' and numbers, but first character should be an alphabet or number"))
return probe.NewError(errors.New("Bucket names can contain lowercase alpha characters `a-z`, numbers '0-9', and '-'. First character cannot be a '-'"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't Bucket names can *only* contain more firm ?

Copy link
Contributor Author

@badscooter23 badscooter23 Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this wording change... will do it now! When I was playing with it yesterday I had the same basic idea...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants