fix(ai-search): normalize media MIME type case-insensitively (#358)
* fix(ai-search): normalize media MIME type case-insensitively * fix(sheets): satisfy exactOptionalPropertyTypes for LazyCellMatch rawValue --------- Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
This commit is contained in:
co-authored by
Aniruddha Adak
parent
6797e48c15
commit
78f133c216
@@ -99,7 +99,8 @@ export async function loadMediaReference(ref: string): Promise<MediaBlob> {
|
||||
if (bytes.byteLength > MAX_MEDIA_BYTES) {
|
||||
throw new MediaTooLargeError(`${ref} is too large to analyze`)
|
||||
}
|
||||
const ct = resp.headers.get('content-type')?.split(';')[0]?.trim()
|
||||
const rawCt = resp.headers.get('content-type')?.split(';')[0]?.trim().toLowerCase()
|
||||
const ct = rawCt && rawCt !== 'application/octet-stream' ? rawCt : undefined
|
||||
const name = basename(new URL(ref).pathname) || undefined
|
||||
const mime =
|
||||
ct && ct !== 'application/octet-stream' ? ct : MIME_BY_EXT[extname(name ?? '').toLowerCase()]
|
||||
|
||||
Reference in New Issue
Block a user