Skip to content

Commit

Permalink
Merge pull request #410 from skaut/shortcuts
Browse files Browse the repository at this point in the history
Added support for Drive shortcuts
  • Loading branch information
marekdedic authored Jan 14, 2021
2 parents 1403ccc + beed444 commit 341354c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/backend/listFolders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ function listFolders(parentID: string): Array<NamedRecord> {
q:
'"' +
parentID +
'" in parents and mimeType = "application/vnd.google-apps.folder" and trashed = false',
'" in parents and (mimeType = "application/vnd.google-apps.folder" or (mimeType = "application/vnd.google-apps.shortcut" and shortcutDetails.targetMimeType = "application/vnd.google-apps.folder")) and trashed = false',
supportsAllDrives: true,
pageToken: pageToken,
maxResults: 1000,
fields: "nextPageToken, items(id, title)",
fields:
"nextPageToken, items(id, title, mimeType, shortcutDetails(targetId))",
});
for (const item of response.items!) {
ret.push({ id: item.id!, name: item.title! });
const id =
item.mimeType === "application/vnd.google-apps.shortcut"
? item.shortcutDetails!.targetId!
: item.id!;
ret.push({ id, name: item.title! });
}
pageToken = response.nextPageToken;
} while (pageToken !== undefined);
Expand Down

0 comments on commit 341354c

Please sign in to comment.