Skip to content

Commit

Permalink
fix(upload-file): take root_workspace_id as default when uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Aug 13, 2023
1 parent 795c2c7 commit f6d6c22
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions supabase/functions/upload-file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ serve(async (req: Request) => {
const formData = await req.formData();
const formDataFiles = formData.getAll("files") as File[];

const workspaceId = formData.get("workspace_id") as string | undefined;
if (user_profile && !workspaceId) return json({
success: false,
message: "Authenticated users should always specify a workspace ID."
});
const workspaceId = (formData.get("workspace_id") as string | undefined) ?? user_profile?.root_workspace_id ?? undefined;

const isPrivate = parseInt((formData.get("private") as string | null) ?? "1");
const newUploadsInDatabase: UploadedFile[] = [];
Expand Down

0 comments on commit f6d6c22

Please sign in to comment.