diff options
author | Luis Pabon <lpabon@redhat.com> | 2013-06-21 16:41:50 -0400 |
---|---|---|
committer | Peter Portante <pportant@redhat.com> | 2013-06-28 13:17:50 -0700 |
commit | 5cef798f8dcdee0d0512e47b67ac67d5f8d6c14c (patch) | |
tree | 73dce36cbfc970b5a363bd0dbd33ade5ff291ac8 /gluster/swift/common/constraints.py | |
parent | 92fdc68d6b90f4f7327bdffe542c5e8807a3e6c5 (diff) |
OpenStack Swift Functional Tests for G4S
This commit has the following changes:
* G4S no longer accepts URLs that end in /. A HTTP code
of 400 is returned when a / at the end of the object
is detected.
* Directories can be created as objects setting the
content-type to application/directory and content-length
to 0.
* Functional tests have been adjusted to work with
G4S constraints
Change-Id: I31038a59699a8e3eeaba902db322218c6400093e
Signed-off-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/5246
Reviewed-by: Peter Portante <pportant@redhat.com>
Tested-by: Peter Portante <pportant@redhat.com>
Diffstat (limited to 'gluster/swift/common/constraints.py')
-rw-r--r-- | gluster/swift/common/constraints.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gluster/swift/common/constraints.py b/gluster/swift/common/constraints.py index acdd3f5..ce1df31 100644 --- a/gluster/swift/common/constraints.py +++ b/gluster/swift/common/constraints.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os try: from webob.exc import HTTPBadRequest except ImportError: @@ -45,6 +46,8 @@ def get_object_name_component_length(): def validate_obj_name_component(obj): + if not obj: + return 'cannot begin, end, or have contiguous %s\'s' % os.path.sep if len(obj) > MAX_OBJECT_NAME_COMPONENT_LENGTH: return 'too long (%d)' % len(obj) if obj == '.' or obj == '..': @@ -74,7 +77,7 @@ def gluster_check_object_creation(req, object_name): ret = __check_object_creation(req, object_name) if ret is None: - for obj in object_name.split('/'): + for obj in object_name.split(os.path.sep): reason = validate_obj_name_component(obj) if reason: bdy = 'Invalid object name "%s", component "%s" %s' \ |