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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View file

@ -26,7 +26,7 @@ describe('test GoogleDriveV2: file download', () => {
jest.unmock('../../../../v2/transport');
});
it('shuold be called with', async () => {
it('should be called with', async () => {
const nodeParameters = {
operation: 'deleteFile',
fileId: {
@ -58,7 +58,7 @@ describe('test GoogleDriveV2: file download', () => {
{},
{ alt: 'media' },
undefined,
{ encoding: null, json: false, resolveWithFullResponse: true, useStream: true },
{ encoding: 'arraybuffer', json: false, returnFullResponse: true, useStream: true },
);
});
});

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') {