parent
94effb5aaa
commit
ee0eb80c8f
6 changed files with 14 additions and 10 deletions
|
@ -268,7 +268,7 @@ class SwiftStorage(BaseStorage):
|
|||
|
||||
return random_uuid, metadata
|
||||
|
||||
def stream_upload_chunk(self, uuid, offset, length, in_fp, storage_metadata):
|
||||
def stream_upload_chunk(self, uuid, offset, length, in_fp, storage_metadata, content_type=None):
|
||||
if length == 0:
|
||||
return 0, storage_metadata
|
||||
|
||||
|
@ -277,7 +277,7 @@ class SwiftStorage(BaseStorage):
|
|||
total_bytes_written = 0
|
||||
while True:
|
||||
bytes_written, storage_metadata = self._stream_upload_segment(uuid, offset, length, in_fp,
|
||||
storage_metadata)
|
||||
storage_metadata, content_type)
|
||||
|
||||
if length != filelike.READ_UNTIL_END:
|
||||
length = length - bytes_written
|
||||
|
@ -287,7 +287,7 @@ class SwiftStorage(BaseStorage):
|
|||
if bytes_written == 0 or length <= 0:
|
||||
return total_bytes_written, storage_metadata
|
||||
|
||||
def _stream_upload_segment(self, uuid, offset, length, in_fp, storage_metadata):
|
||||
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)
|
||||
|
@ -302,7 +302,7 @@ class SwiftStorage(BaseStorage):
|
|||
limiting_fp = filelike.LimitingStream(in_fp, length)
|
||||
|
||||
# Write the segment to Swift.
|
||||
self.stream_write(segment_path, limiting_fp)
|
||||
self.stream_write(segment_path, limiting_fp, content_type)
|
||||
|
||||
# We are only going to track keys to which data was confirmed written.
|
||||
bytes_written = limiting_fp.tell()
|
||||
|
|
Reference in a new issue