The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
simplify route
Steven Tey472ce5ff8d2e
diff --git a/apps/web/app/api/oauth/apps/screenshots/upload/route.ts b/apps/web/app/api/oauth/apps/screenshots/upload/route.tsindex 102c7b8dd2..746852f0c8 100644--- a/apps/web/app/api/oauth/apps/screenshots/upload/route.ts+++ b/apps/web/app/api/oauth/apps/screenshots/upload/route.ts@@ -1,21 +1,11 @@import { withWorkspace } from "@/lib/auth";import { storage } from "@/lib/storage";-import z from "@/lib/zod";import { nanoid } from "@dub/utils";import { NextResponse } from "next/server";-// TODO:-// How do we restrict this to only be called by the integration form?--const schema = z.object({- name: z.string().min(1).max(100),-});--// POST /api/oauth/apps/signed-url – get a signed URL to upload an integration screenshot-export const GET = withWorkspace(async ({ searchParams }) => {- const { name } = schema.parse(searchParams);-- const key = `integration-screenshots/${nanoid(7)}/${name}`;+// POST /api/oauth/apps/screenshots/upload – get a signed URL to upload an integration screenshot+export const POST = withWorkspace(async () => {+ const key = `integration-screenshots/${nanoid(16)}`;const signedUrl = await storage.getSignedUrl(key);diff --git a/apps/web/ui/integrations/add-edit-integration-form.tsx b/apps/web/ui/integrations/add-edit-integration-form.tsxindex c0ab598dde..1ff80ac909 100644--- a/apps/web/ui/integrations/add-edit-integration-form.tsx+++ b/apps/web/ui/integrations/add-edit-integration-form.tsx@@ -144,7 +144,7 @@ export default function AddEditIntegrationForm({setScreenshots((prev) => [...prev, { file, uploading: true }]);const response = await fetch(- `/api/oauth/apps/screenshots/upload?workspaceId=${workspaceId}&name=${file.name}`,+ `/api/oauth/apps/screenshots/upload?workspaceId=${workspaceId}`,{method: "GET",},