θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

Conversation

@Guru6163
Copy link
Contributor

@Guru6163 Guru6163 commented Oct 9, 2025

Pull Request Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ”¨ chore
  • πŸ“ docs

Relevant Issues

resolves #4513

Root Cause

The downloadURIToFile function was using path.basename(url) to determine filenames, which didn't account for HTTP Content-Type headers that indicate the actual file type.

Solution

Enhanced the file download logic to:

  • Extract Content-Type from HTTP response headers
  • Map Content-Type to appropriate file extension using existing ACCEPTED_MIMES configuration
  • Generate proper filenames with correct extensions

Changes

  • Added getExtensionFromContentType() function to map MIME types to extensions
  • Added generateSafeFilename() function for Content-Type aware filename generation
  • Modified download logic to use Content-Type headers for proper file extension assignment

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: File Parsing Fails for URLs Without Explicit File Extensions

3 participants