Skip to content

Commit

Permalink
fix(Google Drive Node): Process all input items with List operation (#…
Browse files Browse the repository at this point in the history
…3525)

* Fix: process all input items in GDrive list

* ⚡ linter fixes

* ⚡ added versioning

* ⚡ fix option naming

* ⚡ removed option for choosing list operation behavior

* ⚡ Improvement

Co-authored-by: Yann Jouanique <[email protected]>
Co-authored-by: ricardo <[email protected]>
  • Loading branch information
3 people authored Jul 10, 2022
1 parent ce06d9b commit ece1836
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class GoogleDrive implements INodeType {
name: 'googleDrive',
icon: 'file:googleDrive.svg',
group: ['input'],
version: 1,
version: [1, 2],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Access data on Google Drive',
defaults: {
Expand Down Expand Up @@ -475,7 +475,7 @@ export class GoogleDrive implements INodeType {
minValue: 1,
maxValue: 1000,
},
default: 100,
default: 50,
description: 'Max number of results to return',
},
{
Expand Down Expand Up @@ -951,7 +951,7 @@ export class GoogleDrive implements INodeType {
type: 'multiOptions',
options: [
{
name: '*',
name: '[All]',
value: '*',
description: 'All fields',
},
Expand Down Expand Up @@ -1404,7 +1404,7 @@ export class GoogleDrive implements INodeType {
},
options: [
{
name: '*',
name: '[All]',
value: '*',
description: 'All spaces',
},
Expand Down Expand Up @@ -2268,6 +2268,7 @@ export class GoogleDrive implements INodeType {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.
// @ts-ignore
Object.assign(newItem.binary, items[i].binary);
}

Expand Down Expand Up @@ -2365,7 +2366,13 @@ export class GoogleDrive implements INodeType {

const files = response!.files;

return [this.helpers.returnJsonArray(files as IDataObject[])];
const version = this.getNode().typeVersion;

if (version === 1) {
return [this.helpers.returnJsonArray(files as IDataObject[])];
} else {
returnData.push(...files);
}

} else if (operation === 'upload') {
// ----------------------------------
Expand Down

0 comments on commit ece1836

Please sign in to comment.