Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(api): validate org Google Drive upload support on video init

Richie McIlroy5aa52d422cad
diff --git a/apps/web/app/api/desktop/[...route]/video.ts b/apps/web/app/api/desktop/[...route]/video.ts
index 72b6d9b2e..6ce8d6aa6 100644
--- a/apps/web/app/api/desktop/[...route]/video.ts
+++ b/apps/web/app/api/desktop/[...route]/video.ts
@@ -174,9 +174,24 @@ app.get(
c.req,
GOOGLE_DRIVE_UPLOAD_FEATURE,
);
+ const organizationWritable =
+ await Storage.getOrganizationWritableAccess(videoOrgId).pipe(
+ runPromise,
+ );
+ if (
+ !clientSupportsGoogleDriveUpload &&
+ Option.isSome(organizationWritable) &&
+ organizationWritable.value.access.provider === "googleDrive"
+ ) {
+ return c.json(
+ { error: "google_drive_upload_unsupported" },
+ { status: 426 },
+ );
+ }
+
const writable = await (clientSupportsGoogleDriveUpload
- ? Storage.getWritableAccessForUser(user.id)
- : Storage.getS3WritableAccessForUser(user.id)
+ ? Storage.getWritableAccessForUser(user.id, videoOrgId)
+ : Storage.getS3WritableAccessForUser(user.id, videoOrgId)
).pipe(runPromise);
await db()