Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions components/google_drive/actions/find-folder/find-folder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "google_drive-find-folder",
name: "Find Folder",
description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
googleDrive,
Expand All @@ -34,16 +34,24 @@ export default {
},
},
async run({ $ }) {
let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name contains '${this.nameSearchTerm}'`.trim();
const escapedSearchTerm = this.nameSearchTerm?.replace(/'/g, "\\'") || "";
let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name contains '${escapedSearchTerm}'`.trim();
if (!this.includeTrashed) {
q += " and trashed=false";
}
const opts = getListFilesOpts(this.drive, {
q,
});
const folders = (await this.googleDrive.listFilesInPage(null, opts)).files;
// eslint-disable-next-line multiline-ternary
$.export("$summary", `Successfully found ${folders.length} folder${folders.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
return folders;

try {
const { files: folders } = await this.googleDrive.listFilesInPage(null, opts);
// eslint-disable-next-line multiline-ternary
$.export("$summary", `Successfully found ${folders.length} folder${folders.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
return folders;

} catch (error) {
console.log("Failed to find folders with query", error.response?.data?.error || error);
throw JSON.stringify(error.response?.data?.error, null, 2);
}
},
};
2 changes: 1 addition & 1 deletion components/google_drive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_drive",
"version": "0.9.1",
"version": "0.9.2",
"description": "Pipedream Google_drive Components",
"main": "google_drive.app.mjs",
"keywords": [
Expand Down
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading