Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/file-card-download-label.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@buildinternet/uploads": patch
---

The public file page's card for non-media files now labels its link "Download <name>" when it points at the forced-download URL.
6 changes: 4 additions & 2 deletions apps/web/src/components/MediaFallback.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ interface Props {
body?: string;
href?: string | null;
filename?: string;
/** Link text override; defaults to `Open <filename>` / `Open original`. */
label?: string;
/** Start hidden until `applyMediaFailure` unhides it. */
pending?: boolean;
/** Tighter padding for gallery-grid tiles. */
compact?: boolean;
}

const { title, body, href = null, filename, pending = false, compact = false } = Astro.props;
const { title, body, href = null, filename, label, pending = false, compact = false } = Astro.props;
---

<div
Expand All @@ -29,7 +31,7 @@ const { title, body, href = null, filename, pending = false, compact = false } =
{
href ? (
<a href={href} rel="noopener noreferrer">
{filename ? `Open ${filename}` : "Open original"}
{label ?? (filename ? `Open ${filename}` : "Open original")}
</a>
) : null
}
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/MediaStage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const fileCardBody = `${fileTypeLabel(filename, contentType ?? "")} · ${
body={fileCardBody}
href={fileHref}
filename={filename}
label={downloadUrl ? `Download ${filename}` : undefined}
/>
))}
{kind === "missing" && (
Expand Down
Loading