merlyn/collector/__tests__/utils
Yitong Li 2f7a818744
fix(collector): infer file extension from Content-Type for URLs without explicit extensions (#5252)
* fix(collector): infer file extension from Content-Type for URLs without explicit extensions

When downloading files from URLs like https://arxiv.org/pdf/2307.10265,
the path has no recognizable file extension. The downloaded file gets
saved without an extension (or with a nonsensical one like .10265),
causing processSingleFile to reject it with 'File extension .10265
not supported for parsing'.

Fix: after downloading, check if the filename has a supported file
extension. If not, inspect the response Content-Type header and map
it to the correct extension using the existing ACCEPTED_MIMES table.

For example, a response with Content-Type: application/pdf will cause
the file to be saved with a .pdf extension, allowing it to be processed
correctly.

Fixes #4513

* small refactor

---------

Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
2026-03-23 09:40:22 -07:00
..
downloadURIToFile fix(collector): infer file extension from Content-Type for URLs without explicit extensions (#5252) 2026-03-23 09:40:22 -07:00
url Add ability to auto-handle YT video URLs in uploader & chat (#4547) 2025-10-15 12:18:57 -07:00
WhisperProviders/ffmpeg Adjust fix path to use ESM import (#4867) 2026-01-15 16:13:21 -08:00