Skip to content

Commit 8eddf1c

Browse files
dobkinclaude
andcommitted
docs(web): document the composer attachment classifier helpers
Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent ecada07 commit 8eddf1c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎apps/web/src/components/chat/composerAttachmentFiles.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export function normalizeComposerImageFileMimeType(file: File): File {
6868
*/
6969
export const DNG_FILE_MIME_TYPE = "image/x-adobe-dng";
7070

71+
/** Lower-cased media type without parameters, e.g. `image/dng; q=1` → `image/dng`. */
7172
function baseMimeType(type: string): string {
7273
return type.split(";", 1)[0]?.trim().toLowerCase() ?? "";
7374
}
@@ -104,6 +105,12 @@ export function composerFileAttachmentMimeType(file: Pick<File, "name" | "type">
104105
);
105106
}
106107

108+
/**
109+
* Decides which composer path a picked, dropped or pasted file takes: `image` goes
110+
* through preview and compression, `file` is uploaded as-is, `unsupported-image`
111+
* is reported to the user. DNG is checked first because browsers may label it as
112+
* an image type the other branches would accept.
113+
*/
107114
export function classifyComposerAttachmentFile(
108115
file: Pick<File, "name" | "type">,
109116
): ComposerAttachmentFileKind {

0 commit comments

Comments
 (0)