Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyicloud/services/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def send_file(self, folder_id, file_object):

def create_folders(self, parent, name):
"""Creates a new iCloud Drive folder"""
# when creating a folder on icloud.com, the clientID is set to the following:
temp_client_id = f"FOLDER::UNKNOWN_ZONE::TempId-{uuid.uuid4()}"
request = self.session.post(
self._service_root + "/createFolders",
params=self.params,
Expand All @@ -166,7 +168,7 @@ def create_folders(self, parent, name):
"destinationDrivewsId": parent,
"folders": [
{
"clientId": self.params["clientId"],
"clientId": temp_client_id,
"name": name,
}
],
Expand Down Expand Up @@ -198,6 +200,8 @@ def rename_items(self, node_id, etag, name):

def move_items_to_trash(self, node_id, etag):
"""Moves an iCloud Drive node to the trash bin"""
# when moving a node to the trash on icloud.com, the clientID is set to the node_id:
temp_client_id = node_id
request = self.session.post(
self._service_root + "/moveItemsToTrash",
params=self.params,
Expand All @@ -207,7 +211,7 @@ def move_items_to_trash(self, node_id, etag):
{
"drivewsid": node_id,
"etag": etag,
"clientId": self.params["clientId"],
"clientId": temp_client_id,
}
],
}
Expand Down