fix: send non-JPEG images as document instead of photo; fix Dockerfile home.html path
Deploy FileDrop / deploy (push) Failing after 23s
Deploy FileDrop / deploy (push) Failing after 23s
- getFileType: only classify image/jpeg as 'photo'; png/gif/webp → 'document' (Telegram Bot API rejects non-JPEG for sendPhoto) - Dockerfile: copy home.html to dist/ instead of root (import.meta.dir = dist/) - Update test assertion for getFileType(image/png) → 'document'
This commit is contained in:
@@ -85,7 +85,12 @@ export const getFileType = (mime: string | null, caption?: string): string => {
|
||||
if (mimeUpper === 'video') return 'video';
|
||||
if (mimeUpper === 'audio') return 'audio';
|
||||
if (mimeUpper === 'document') return 'document';
|
||||
if (mimeUpper === 'image') return captionLower?.includes('gif') ? 'animation' : 'photo';
|
||||
// ── Photo (JPEG only; Telegram Bot API rejects non-JPEG for sendPhoto) ──
|
||||
if (mimeUpper === 'image') {
|
||||
if (captionLower?.includes('gif')) return 'animation';
|
||||
if (mime?.toLowerCase() === 'image/jpeg' || mime?.toLowerCase() === 'image/jpg') return 'photo';
|
||||
return 'document';
|
||||
}
|
||||
if (captionLower?.includes('voice')) return 'voice';
|
||||
if (captionLower?.includes('animation')) return 'animation';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user