diff --git a/storage/swift.py b/storage/swift.py index a341af9b1..f96e5c0de 100644 --- a/storage/swift.py +++ b/storage/swift.py @@ -298,7 +298,7 @@ class SwiftStorage(BaseStorage): def _stream_upload_segment(self, uuid, offset, length, in_fp, storage_metadata, content_type): updated_metadata = copy.deepcopy(storage_metadata) segment_count = len(updated_metadata[_SEGMENTS_KEY]) - segment_path = '%s/%s/%s' % (_SEGMENT_DIRECTORY, uuid, segment_count) + segment_path = '%s/%s/%s' % (_SEGMENT_DIRECTORY, uuid, '%09d' % segment_count) # Track the number of bytes read and if an explicit length is specified, limit the # file stream to that length. diff --git a/storage/test/test_swift.py b/storage/test/test_swift.py index 28319e956..354df22e4 100644 --- a/storage/test/test_swift.py +++ b/storage/test/test_swift.py @@ -84,7 +84,7 @@ class FakeSwift(object): if ('container-name/' + key).startswith(prefix): new_contents.append((key, value['content'])) - new_contents.sort(key=lambda value: int(value[0].split('/')[-1])) + new_contents.sort(key=lambda value: value[0]) data = dict(data) data['content'] = ''.join([nc[1] for nc in new_contents])