Allow inline video attachment previews

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Dotta
2026-06-03 23:17:16 +00:00
parent 5d91c1bb29
commit 5f481d50f1
4 changed files with 22 additions and 11 deletions
+8 -6
View File
@@ -7,6 +7,12 @@ const GENERIC_ATTACHMENT_CONTENT_TYPES = new Set([
"application/x-binary",
]);
type AttachmentPathLike = {
contentPath: string;
openPath?: string;
downloadPath?: string;
};
function normalizedContentType(attachment: Pick<IssueAttachment, "contentType">) {
return attachment.contentType.toLowerCase().split(";")[0]?.trim() ?? "";
}
@@ -15,15 +21,11 @@ export function attachmentFilename(attachment: Pick<IssueAttachment, "id" | "ori
return attachment.originalFilename ?? attachment.id;
}
export function attachmentOpenPath(
attachment: Pick<IssueAttachment, "contentPath" | "openPath">,
) {
export function attachmentOpenPath(attachment: AttachmentPathLike) {
return attachment.openPath ?? attachment.contentPath;
}
export function attachmentDownloadPath(
attachment: Pick<IssueAttachment, "contentPath" | "downloadPath">,
) {
export function attachmentDownloadPath(attachment: AttachmentPathLike) {
return attachment.downloadPath ?? `${attachment.contentPath}?download=1`;
}