Skip to content

Commit

Permalink
Return NoSuchBucket/Key on 404.
Browse files Browse the repository at this point in the history
- Fixes bug 945937.

Change-Id: If6dd53a716491a7d1a9ab4992224038ede4cb32a
  • Loading branch information
chmouel committed Mar 7, 2012
1 parent ad6684a commit ac76344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions swift/common/middleware/swift3.py
Expand Up @@ -240,7 +240,7 @@ def GET(self, env, start_response):
if status == 401:
return get_err_response('AccessDenied')
elif status == 404:
return get_err_response('InvalidBucketName')
return get_err_response('NoSuchBucket')
else:
return get_err_response('InvalidURI')

Expand Down Expand Up @@ -311,7 +311,7 @@ def DELETE(self, env, start_response):
if status == 401:
return get_err_response('AccessDenied')
elif status == 404:
return get_err_response('InvalidBucketName')
return get_err_response('NoSuchBucket')
elif status == 409:
return get_err_response('BucketNotEmpty')
else:
Expand Down Expand Up @@ -397,7 +397,7 @@ def PUT(self, env, start_response):
if status == 401:
return get_err_response('AccessDenied')
elif status == 404:
return get_err_response('InvalidBucketName')
return get_err_response('NoSuchBucket')
else:
return get_err_response('InvalidURI')

Expand Down
6 changes: 3 additions & 3 deletions test/unit/common/middleware/test_swift3.py
Expand Up @@ -261,7 +261,7 @@ def test_bucket_GET_error(self):
code = self._test_method_error(FakeAppBucket, 'GET', '/bucket', 401)
self.assertEquals(code, 'AccessDenied')
code = self._test_method_error(FakeAppBucket, 'GET', '/bucket', 404)
self.assertEquals(code, 'InvalidBucketName')
self.assertEquals(code, 'NoSuchBucket')
code = self._test_method_error(FakeAppBucket, 'GET', '/bucket', 0)
self.assertEquals(code, 'InvalidURI')

Expand Down Expand Up @@ -394,7 +394,7 @@ def test_bucket_DELETE_error(self):
code = self._test_method_error(FakeAppBucket, 'DELETE', '/bucket', 401)
self.assertEquals(code, 'AccessDenied')
code = self._test_method_error(FakeAppBucket, 'DELETE', '/bucket', 404)
self.assertEquals(code, 'InvalidBucketName')
self.assertEquals(code, 'NoSuchBucket')
code = self._test_method_error(FakeAppBucket, 'DELETE', '/bucket', 409)
self.assertEquals(code, 'BucketNotEmpty')
code = self._test_method_error(FakeAppBucket, 'DELETE', '/bucket', 0)
Expand Down Expand Up @@ -470,7 +470,7 @@ def test_object_PUT_error(self):
self.assertEquals(code, 'AccessDenied')
code = self._test_method_error(FakeAppObject, 'PUT',
'/bucket/object', 404)
self.assertEquals(code, 'InvalidBucketName')
self.assertEquals(code, 'NoSuchBucket')
code = self._test_method_error(FakeAppObject, 'PUT',
'/bucket/object', 0)
self.assertEquals(code, 'InvalidURI')
Expand Down

0 comments on commit ac76344

Please sign in to comment.