From 163ef9b5db470c6ae3438bb2cd07fdb4e393a818 Mon Sep 17 00:00:00 2001 From: mbaharip <62494292+mbahArip@users.noreply.github.com> Date: Mon, 22 Apr 2024 21:28:07 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20teamdrive=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/actions.ts | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/app/actions.ts b/src/app/actions.ts index 1dc7f91..cd00fee 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -216,8 +216,12 @@ export async function CheckPassword( q: query.join(" and "), fields: "files(id, name, mimeType, parents)", pageSize: 1000, - supportsAllDrives: config.apiConfig.isTeamDrive, - includeItemsFromAllDrives: config.apiConfig.isTeamDrive, + ...(config.apiConfig.isTeamDrive && { + supportsAllDrives: true, + includeItemsFromAllDrives: true, + driveId: config.apiConfig.rootFolder, + corpora: "drive", + }), }); // To save processing time, skip if password file not found @@ -353,8 +357,12 @@ export async function GetFiles({ orderBy: config.apiConfig.defaultOrder, pageSize: config.apiConfig.itemsPerPage, pageToken: pageToken, - supportsAllDrives: config.apiConfig.isTeamDrive, - includeItemsFromAllDrives: config.apiConfig.isTeamDrive, + ...(config.apiConfig.isTeamDrive && { + supportsAllDrives: true, + includeItemsFromAllDrives: true, + driveId: config.apiConfig.rootFolder, + corpora: "drive", + }), }); const encryptedData: z.infer[] = []; @@ -471,8 +479,12 @@ export async function SearchFile( orderBy: "name_natural desc", pageSize: config.apiConfig.searchResult, pageToken: nextPageToken, - supportsAllDrives: config.apiConfig.isTeamDrive, - includeItemsFromAllDrives: config.apiConfig.isTeamDrive, + ...(config.apiConfig.isTeamDrive && { + supportsAllDrives: true, + includeItemsFromAllDrives: true, + driveId: config.apiConfig.rootFolder, + corpora: "drive", + }), }); const encryptedData: z.infer[] = []; if (!data.data.files?.length) @@ -593,8 +605,12 @@ export async function GetReadme( orderBy: config.apiConfig.defaultOrder, pageSize: config.apiConfig.itemsPerPage, pageToken: undefined, - supportsAllDrives: config.apiConfig.isTeamDrive, - includeItemsFromAllDrives: config.apiConfig.isTeamDrive, + ...(config.apiConfig.isTeamDrive && { + supportsAllDrives: true, + includeItemsFromAllDrives: true, + driveId: config.apiConfig.rootFolder, + corpora: "drive", + }), }); if (!data.files?.length) return null; @@ -634,8 +650,12 @@ export async function GetBanner( orderBy: config.apiConfig.defaultOrder, pageSize: config.apiConfig.itemsPerPage, pageToken: undefined, - supportsAllDrives: config.apiConfig.isTeamDrive, - includeItemsFromAllDrives: config.apiConfig.isTeamDrive, + ...(config.apiConfig.isTeamDrive && { + supportsAllDrives: true, + includeItemsFromAllDrives: true, + driveId: config.apiConfig.rootFolder, + corpora: "drive", + }), }); if (!data.files?.length) return null;