mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
fix(Google Drive Node): Fix issue preventing service account from downloading files (#7642)
This commit is contained in:
parent
52a2e25a25
commit
cf7131d766
|
@ -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 },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -192,8 +192,8 @@ export async function execute(
|
|||
|
||||
const requestOptions = {
|
||||
useStream: true,
|
||||
resolveWithFullResponse: true,
|
||||
encoding: null,
|
||||
returnFullResponse: true,
|
||||
encoding: 'arraybuffer',
|
||||
json: false,
|
||||
};
|
||||
|
||||
|
|
|
@ -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') {
|
||||
|
|
Loading…
Reference in a new issue