Fix NoMethodError in copy_files for unknown mime types (webp)#72513
Open
fisher-alice wants to merge 3 commits intostagingfrom
Open
Fix NoMethodError in copy_files for unknown mime types (webp)#72513fisher-alice wants to merge 3 commits intostagingfrom
fisher-alice wants to merge 3 commits intostagingfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a NoMethodError during project/asset copy when an uploaded file’s extension is missing from the MIME type table (notably .webp), and aligns file serving to use globally-registered MIME mappings.
Changes:
- Prevents
copy_filesfrom crashing whenSinatra::Base.mime_typereturnsnilfor an extension. - Registers missing MIME types (
.webp,.md) in Rack’s global MIME table so Sinatra/Rack resolution works consistently. - Simplifies
get_filecontent type handling by removing per-request default overrides and relying on the global MIME table.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dashboard/legacy/middleware/helpers/bucket_helper.rb | Avoids split on a nil MIME type when copying files. |
| dashboard/legacy/middleware/files_api.rb | Registers .webp/.md MIME types globally and simplifies content_type usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sanchitmalhotra126
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We recently started supporting
webpfiles in #72228, and added a default mime type forwebpin #72276 forget_fileinfiles_api.rbsince Rack does not provide the mime type for this file type. However, it appears like we are getting a similar error forcopy_filesinbucket_helper.rbso we update the global Rack MIME types table to includewebpandmd.Links
Testing story
mdfile, save it to backpack and then add it to a project on a different level.Currently,
webpfiles are supported when a model generates the image. I am a little puzzled on howwebpfiles are being added to projects as they are NOT explicitly supported in the Animation Picker, the Assets Uploader nor the Lab2 Uploader.It seems like we're hitting this error when we're copying assets over (like when a user remixes a project), but unsure how
webpfiles are being added to begin with. It seems like these HoneyBadger errors began when we started supportingwebpfiles (April 22). We know that users are uploading files whose file extensions are not accurate. See #72152. We will continue monitoring.Deployment notes
Privacy and security