Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Download logos

Tim Wilson7846cdcb24a0
diff --git a/apps/web/lib/actions/partners/program-resources/add-program-resource.ts b/apps/web/lib/actions/partners/program-resources/add-program-resource.ts
index ce85de0efd..8a8f70664a 100644
--- a/apps/web/lib/actions/partners/program-resources/add-program-resource.ts
+++ b/apps/web/lib/actions/partners/program-resources/add-program-resource.ts
@@ -71,7 +71,17 @@ export const addProgramResourceAction = authActionClient
// Upload the file to storage
const fileKey = `programs/${program.id}/${resourceType}s/${slugify(name || resourceType)}-${nanoid(4)}${extension ? `.${extension}` : ""}`;
- const uploadResult = await storage.upload(fileKey, file);
+ const uploadResult = await storage.upload(
+ fileKey,
+ file,
+ resourceType === "logo"
+ ? {
+ headers: {
+ "Content-Disposition": "attachment",
+ },
+ }
+ : undefined,
+ );
if (!uploadResult || !uploadResult.url) {
throw new Error(`Failed to upload ${resourceType}`);
diff --git a/apps/web/lib/storage.ts b/apps/web/lib/storage.ts
index 90c6714a12..8cdcd445a2 100644
--- a/apps/web/lib/storage.ts
+++ b/apps/web/lib/storage.ts
@@ -5,6 +5,7 @@ interface imageOptions {
contentType?: string;
width?: number;
height?: number;
+ headers?: Record<string, string>;
}
class StorageClient {
@@ -35,6 +36,7 @@ class StorageClient {
const headers = {
"Content-Length": uploadBody.size.toString(),
+ ...opts?.headers,
};
if (opts?.contentType) headers["Content-Type"] = opts.contentType;
diff --git a/apps/web/ui/partners/resources/resource-card.tsx b/apps/web/ui/partners/resources/resource-card.tsx
index 56c9f955e9..bd93114921 100644
--- a/apps/web/ui/partners/resources/resource-card.tsx
+++ b/apps/web/ui/partners/resources/resource-card.tsx
@@ -4,6 +4,7 @@ import { ProgramResourceType } from "@/lib/zod/schemas/program-resources";
import { ThreeDots } from "@/ui/shared/icons";
import {
Button,
+ buttonVariants,
Check,
Copy,
Download,
@@ -75,18 +76,19 @@ export function ResourceCard({
href={downloadUrl}
{...(resourceType === "logo"
? {
- download: downloadUrl,
+ download: true,
}
: {
target: "_blank",
})}
+ className={cn(
+ buttonVariants({ variant: "outline" }),
+ "flex h-9 items-center justify-start gap-2 rounded-md px-2 text-sm font-medium",
+ )}
+ onClick={() => setOpenPopover(false)}
>
- <Button
- text="Download"
- variant="outline"
- icon={<Download className="size-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
+ <Download className="size-4" />
+ Download
</a>
)}
{copyText && (
@@ -156,17 +158,19 @@ export function ResourceCard({
href={downloadUrl}
{...(resourceType === "logo"
? {
- download: downloadUrl,
+ download: true,
}
: {
target: "_blank",
})}
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-8 items-center justify-start gap-2 rounded-md border px-2 text-sm",
+ )}
+ onClick={() => setOpenPopover(false)}
>
- <Button
- icon={<Download className="size-4" />}
- text="Download"
- variant="secondary"
- />
+ <Download className="size-4" />
+ Download
</a>
)}
{copyText && (