@pipedream/google_drive 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export default {
7
7
  key: "google_drive-find-folder",
8
8
  name: "Find Folder",
9
9
  description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
10
- version: "0.1.8",
10
+ version: "0.1.9",
11
11
  type: "action",
12
12
  props: {
13
13
  googleDrive,
@@ -34,16 +34,24 @@ export default {
34
34
  },
35
35
  },
36
36
  async run({ $ }) {
37
- let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name contains '${this.nameSearchTerm}'`.trim();
37
+ const escapedSearchTerm = this.nameSearchTerm?.replace(/'/g, "\\'") || "";
38
+ let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name contains '${escapedSearchTerm}'`.trim();
38
39
  if (!this.includeTrashed) {
39
40
  q += " and trashed=false";
40
41
  }
41
42
  const opts = getListFilesOpts(this.drive, {
42
43
  q,
43
44
  });
44
- const folders = (await this.googleDrive.listFilesInPage(null, opts)).files;
45
- // eslint-disable-next-line multiline-ternary
46
- $.export("$summary", `Successfully found ${folders.length} folder${folders.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
47
- return folders;
45
+
46
+ try {
47
+ const { files: folders } = await this.googleDrive.listFilesInPage(null, opts);
48
+ // eslint-disable-next-line multiline-ternary
49
+ $.export("$summary", `Successfully found ${folders.length} folder${folders.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
50
+ return folders;
51
+
52
+ } catch (error) {
53
+ console.log("Failed to find folders with query", error.response?.data?.error || error);
54
+ throw JSON.stringify(error.response?.data?.error, null, 2);
55
+ }
48
56
  },
49
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_drive",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Pipedream Google_drive Components",
5
5
  "main": "google_drive.app.mjs",
6
6
  "keywords": [