mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-02 07:54:48 -07:00
fix: verify audio/video MIME types with content check (#16907)
This commit is contained in:
@@ -306,11 +306,15 @@ export async function detectFileType(
|
||||
if (lookedUpMimeType.startsWith('image/')) {
|
||||
return 'image';
|
||||
}
|
||||
if (lookedUpMimeType.startsWith('audio/')) {
|
||||
return 'audio';
|
||||
}
|
||||
if (lookedUpMimeType.startsWith('video/')) {
|
||||
return 'video';
|
||||
// Verify audio/video with content check to avoid MIME misidentification (#16888)
|
||||
if (
|
||||
lookedUpMimeType.startsWith('audio/') ||
|
||||
lookedUpMimeType.startsWith('video/')
|
||||
) {
|
||||
if (!(await isBinaryFile(filePath))) {
|
||||
return 'text';
|
||||
}
|
||||
return lookedUpMimeType.startsWith('audio/') ? 'audio' : 'video';
|
||||
}
|
||||
if (lookedUpMimeType === 'application/pdf') {
|
||||
return 'pdf';
|
||||
|
||||
Reference in New Issue
Block a user