Skip to content

fix: support legacy mime types for file upload#351

Merged
think-in-universe merged 1 commit intomainfrom
fix/support-legacy-mime
Jan 12, 2026
Merged

fix: support legacy mime types for file upload#351
think-in-universe merged 1 commit intomainfrom
fix/support-legacy-mime

Conversation

@hanakannzashi
Copy link
Contributor

@hanakannzashi hanakannzashi commented Jan 12, 2026

Note

Expands accepted MIME types for uploads to cover common legacy/alternative labels.

  • Adds text/xml, text/yaml, and text/x-yaml to ALLOWED_MIME_TYPES
  • Notes application/yaml as RFC 9512 standard in comments

Written by Cursor Bugbot for commit 9f8133f. This will update automatically on new commits. Configure here.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hanakannzashi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request expands the list of recognized MIME types to improve compatibility with legacy or alternative content declarations. It specifically adds support for additional XML and YAML MIME types, ensuring that services can correctly process files using these formats.

Highlights

  • XML MIME Type Support: Added "text/xml" as an alternative MIME type for .xml and .xhtml files, enhancing compatibility with older systems or different content declarations.
  • YAML MIME Type Support: Included "text/yaml" and "text/x-yaml" to the list of allowed MIME types for .yaml and .yml files. These are deprecated but still widely used forms, ensuring broader recognition of YAML content.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@claude
Copy link

claude bot commented Jan 12, 2026

Code Review - PR #351

Reviewed the addition of legacy MIME type support for XML and YAML files.

Analysis

Changes:

  • Added text/xml as alternative MIME type for XML files
  • Added text/yaml and text/x-yaml as deprecated-but-still-used MIME types for YAML files
  • All marked with requires_utf_encoding: true

Findings

No critical issues found. The implementation is correct:

Encoding consistency: All three new MIME types correctly set requires_utf_encoding: true, consistent with:

  • Existing application/xml and application/yaml entries
  • Text-based nature of XML/YAML formats
  • validate_encoding() function requirements (crates/services/src/files/mod.rs:131)

Backward compatibility: This change only expands the allowed MIME types - no breaking changes for existing functionality

Security: No security concerns - the validation logic remains unchanged and properly enforces UTF-8/UTF-16/ASCII encoding for text files

Code quality: Comments clearly document the purpose ("alternative", "deprecated but still used", "RFC 9512 standard")

Recommendation

✅ APPROVED - Safe to merge. This is a straightforward compatibility improvement with no risks.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for legacy MIME types for XML and YAML files, specifically text/xml, text/yaml, and text/x-yaml. The changes are correct and improve compatibility with different clients that might use these alternative MIME types. My suggestion remains to add test coverage for these new types to prevent future regressions.

Comment on lines +75 to +80
("text/xml", true), // .xml (alternative MIME type)
("application/x-bibtex", true), // .bib
// YAML
("application/yaml", true), // .yaml, .yml
("application/yaml", true), // .yaml, .yml (RFC 9512 standard)
("text/yaml", true), // .yaml, .yml (deprecated but still used)
("text/x-yaml", true), // .yaml, .yml (deprecated but still used)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change adds support for legacy MIME types for XML and YAML, which is great for improving compatibility. However, the new types are not covered by tests. To ensure this functionality works as expected and prevent future regressions, please consider adding tests for these new MIME types (text/xml, text/yaml, text/x-yaml) in crates/api/tests/e2e_files.rs. You could add a new test case similar to test_upload_json_file or test_upload_file_success for each new type.

@think-in-universe think-in-universe changed the title fix: support legacy mime fix: support legacy mime types for file upload Jan 12, 2026
@think-in-universe think-in-universe merged commit 392f78f into main Jan 12, 2026
4 checks passed
@think-in-universe think-in-universe deleted the fix/support-legacy-mime branch January 12, 2026 08:40
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.

2 participants