Align attachment video detection with server

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Dotta
2026-06-01 22:00:50 +00:00
parent 54c1ca5eec
commit 0da56d780f
2 changed files with 38 additions and 1 deletions
+9 -1
View File
@@ -1,6 +1,12 @@
import type { IssueAttachment } from "@paperclipai/shared";
import { isVideoContentType } from "./issue-output";
const GENERIC_ATTACHMENT_CONTENT_TYPES = new Set([
"application/octet-stream",
"binary/octet-stream",
"application/x-binary",
]);
function normalizedContentType(attachment: Pick<IssueAttachment, "contentType">) {
return attachment.contentType.toLowerCase().split(";")[0]?.trim() ?? "";
}
@@ -28,7 +34,9 @@ export function isImageAttachment(attachment: Pick<IssueAttachment, "contentType
export function isVideoAttachment(
attachment: Pick<IssueAttachment, "contentType" | "originalFilename">,
) {
if (isVideoContentType(normalizedContentType(attachment))) return true;
const contentType = normalizedContentType(attachment);
if (isVideoContentType(contentType)) return true;
if (!GENERIC_ATTACHMENT_CONTENT_TYPES.has(contentType)) return false;
const filename = (attachment.originalFilename ?? "").toLowerCase();
return (