Skip to content

Commit

Permalink
Merge pull request #361 from harshavardhana/periods
Browse files Browse the repository at this point in the history
helpers: bucket name now validates for double periods.
  • Loading branch information
balamurugana committed Jan 21, 2016
2 parents 0001126 + 7b77808 commit f9b54dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions minio/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def is_valid_bucket_name(bucket_name):
if len(bucket_name) > 63:
raise InvalidBucketError('Bucket name cannot be more than'
' 63 characters.')
if '..' in bucket_name:
raise InvalidBucketError('Bucket name cannot have successive'
' periods.')

match = _VALID_BUCKETNAME_REGEX.match(bucket_name)
if match is None or match.end() != len(bucket_name):
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/minio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def test_bucket_name_invalid_characters(self):
def test_bucket_name_length(self):
is_valid_bucket_name('dd')

@raises(InvalidBucketError)
def test_bucket_name_periods(self):
is_valid_bucket_name('dd..mybucket')

@raises(InvalidBucketError)
def test_bucket_name_begins_period(self):
is_valid_bucket_name('.ddmybucket')

class GetURLTests(TestCase):
def test_get_target_url_works(self):
url = 'http://localhost:9000'
Expand Down

0 comments on commit f9b54dd

Please sign in to comment.