Skip to content

Commit

Permalink
Add support for reading from Shared with me
Browse files Browse the repository at this point in the history
  • Loading branch information
j0nnyr0berts committed Oct 13, 2022
1 parent 6d5e19e commit 4b8acf6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tentaclio_gdrive/clients/google_drive_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _drive(self):
drives = self._get_drives()
if self.drive_name not in drives:
names = [d for d in drives]
raise ValueError(f"Drive name (hostname) should be one of {names}")
raise ValueError(f"Drive name {self.drive_name} should be one of {names}")
return drives[self.drive_name]

def _connect(self) -> "GoogleDriveFSClient":
Expand Down Expand Up @@ -262,12 +262,15 @@ def _get_path_descriptors(self, ignore_tail=False) -> List[_GoogleFileDescriptor
parts = self.path_parts
if ignore_tail:
parts = parts[:-1]
if self.drive_name == "Shared with me":
return [self._get_file_descriptor_by_name(parts[0])]
return list(self._path_parts_to_descriptors(self._drive, parts))

def _path_parts_to_descriptors(
self, drive: _GoogleDriveDescriptor, path_parts: Iterable[str]
) -> List[_GoogleFileDescriptor]:
"""Convert the path parts into google drive descriptors."""

file_descriptors = [drive.root_descriptor]
parent = None
for pathPart in path_parts:
Expand Down

0 comments on commit 4b8acf6

Please sign in to comment.