fix(Google Drive Node): Fix issue preventing service account from downloading files (#7642)

This commit is contained in:
Jon
2024-01-15 15:06:47 +00:00
committed by GitHub
parent 52a2e25a25
commit cf7131d766
3 changed files with 9 additions and 7 deletions

View File

@@ -192,8 +192,8 @@ export async function execute(
const requestOptions = {
useStream: true,
resolveWithFullResponse: true,
encoding: null,
returnFullResponse: true,
encoding: 'arraybuffer',
json: false,
};

View File

@@ -29,7 +29,6 @@ export async function googleApiRequest(
headers: {
'Content-Type': 'application/json',
},
method,
body,
qs,
@@ -38,7 +37,6 @@ export async function googleApiRequest(
};
options = Object.assign({}, options, option);
try {
if (Object.keys(body).length === 0) {
delete options.body;
@@ -52,7 +50,11 @@ export async function googleApiRequest(
options.headers!.Authorization = `Bearer ${access_token}`;
return await this.helpers.httpRequest(options);
} else {
return await this.helpers.requestOAuth2.call(this, 'googleDriveOAuth2Api', options);
return await this.helpers.httpRequestWithAuthentication.call(
this,
'googleDriveOAuth2Api',
options,
);
}
} catch (error) {
if (error.code === 'ERR_OSSL_PEM_NO_START_LINE') {