Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit c28a964

Browse files
committed
Moved to version bridge
Since fragment_upload is async-only, moved it to version bridge. It will overwrite the default `upload_async` methd, too.
1 parent f5fe492 commit c28a964

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/onedrivesdk/extensions/fragment_upload.py renamed to src/onedrivesdk/version_bridge/fragment_upload.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def post_async(self, begin, length, options=None):
129129
return entity
130130

131131

132-
def fragment_upload(self, local_path, conflict_behavior=None, upload_status=None):
132+
def fragment_upload_async(self, local_path, conflict_behavior=None, upload_status=None):
133133
"""Uploads file using PUT using multipart upload if needed.
134134
135135
Args:
@@ -146,7 +146,7 @@ def fragment_upload(self, local_path, conflict_behavior=None, upload_status=None
146146
file_size = os.stat(local_path).st_size
147147
if file_size <= __MAX_SINGLE_FILE_UPLOAD:
148148
# fallback to single shot upload if file is small enough
149-
return self.content.request().upload(local_path)
149+
return self.content.request().upload_async(local_path)
150150
else:
151151
# multipart upload needed for larger files
152152
if conflict_behavior:
@@ -183,4 +183,5 @@ def fragment_upload(self, local_path, conflict_behavior=None, upload_status=None
183183
# return last response
184184
return resp
185185

186-
ItemRequestBuilder.fragment_upload = fragment_upload
186+
# Overwrite the standard upload operation to use this one
187+
ItemRequestBuilder.upload_async = fragment_upload_async

0 commit comments

Comments
 (0)