Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Edwards committed Nov 12, 2024
1 parent 622cd16 commit 60594bb
Showing 1 changed file with 6 additions and 2 deletions.
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 creating a folder 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

0 comments on commit 60594bb

Please sign in to comment.