Skip to content

Commit

Permalink
Add source url
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Mar 4, 2024
1 parent 252e344 commit b27660d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion connectors/src/connectors/google_drive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@ export async function retrieveGoogleDriveContentNodes(
const nodes = await concurrentExecutor(
folderOrFiles,
async (f): Promise<ConnectorNode> => {
const type = getPermissionViewType(f);
let sourceUrl = null;
if (type === "file") {
sourceUrl = `https://drive.google.com/file/d/${f.driveFileId}/view`;
} else if (type === "folder") {
sourceUrl = `https://drive.google.com/drive/folders/${f.driveFileId}`;
} else if (type === "database") {
sourceUrl = `https://docs.google.com/spreadsheets/d/${f.driveFileId}/edit`;
}
return {
provider: "google_drive",
internalId: f.driveFileId,
Expand All @@ -583,7 +592,7 @@ export async function retrieveGoogleDriveContentNodes(
title: f.name || "",
dustDocumentId: getGoogleDriveEntityDocumentId(f),
lastUpdatedAt: f.lastUpsertedTs?.getTime() || null,
sourceUrl: null,
sourceUrl,
expandable:
(await GoogleDriveFiles.findOne({
attributes: ["id"],
Expand Down

0 comments on commit b27660d

Please sign in to comment.