Browse code

* S3/S3.py: Bucket name can't contain upper-case letters (S3/DNS limitation).

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@194 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/06/17 23:13:32
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+2008-06-13  Michal Ludvig  <michal@logix.cz>
2
+
3
+	* S3/S3.py: Bucket name can't contain upper-case letters (S3/DNS limitation).
4
+
1 5
 2008-06-12  Michal Ludvig  <michal@logix.cz>
2 6
 
3 7
 	* S3/PkgInfo.py: Version 0.9.8-rc2
... ...
@@ -469,8 +469,9 @@ class S3(object):
469 469
 		return base64.encodestring(hmac.new(self.config.secret_key, h, sha).digest()).strip()
470 470
 
471 471
 	def check_bucket_name(self, bucket):
472
-		if re.compile("[^A-Za-z0-9\._-]").search(bucket):
473
-			raise ParameterError("Bucket name '%s' contains unallowed characters" % bucket)
472
+		invalid = re.compile("([^a-z0-9\._-])").search(bucket)
473
+		if invalid:
474
+			raise ParameterError("Bucket name '%s' contains disallowed character '%s'. The only supported ones are: lowercase us-ascii letters (a-z), digits (0-9), dot (.), hyphen (-) and underscore (_)." % (bucket, invalid.groups()[0]))
474 475
 		if len(bucket) < 3:
475 476
 			raise ParameterError("Bucket name '%s' is too short (min 3 characters)" % bucket)
476 477
 		if len(bucket) > 255: