Skip to content

Commit c1261ad

Browse files
authored
Merge pull request #1157 from RogerSelwyn/issue_1048
Fix "Protocol not provided to Api Component" when copying files from …
2 parents 0cc3755 + 24cae95 commit c1261ad

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

O365/drive.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,15 @@ def copy(self, target=None, name=None):
842842
# Find out if the server has run a Sync or Async operation
843843
location = response.headers.get('Location', None)
844844

845+
parent = self.drive or self.remote_item
845846
if response.status_code == 202:
846847
# Async operation
847-
return CopyOperation(parent=self.drive, monitor_url=location, target=target_drive)
848+
return CopyOperation(parent=parent, monitor_url=location, target=target_drive)
848849
else:
849850
# Sync operation. Item is ready to be retrieved
850851
path = urlparse(location).path
851852
item_id = path.split('/')[-1]
852-
return CopyOperation(parent=self.drive, item_id=item_id, target=target_drive)
853+
return CopyOperation(parent=parent, item_id=item_id, target=target_drive)
853854

854855
def get_versions(self):
855856
""" Returns a list of available versions for this item

0 commit comments

Comments
 (0)