Need clarification on data design / filtering

Open
#44 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby

Research direction

Read the conversion code in Rakefile around lines 77–80 and compare its output with content_type_mime.db and ext_mime.db. Review the reported diffs and the priority-extensions branch to determine the intended filtering and ordering rules; done means the file’s design is clarified and the conversion behavior is understood.

Written by the indexing model from the issue text.

Description

I’m trying to understand the decisions made when building the content_type_mime.db file, because I’m embarking on a fairly major upgrade to the data in mime-types-data (https://github.com/mime-types/mime-types-data/tree/priority-extensions) where I’ve made it possible to specify relative extension priorities.

As far as I can tell, the ext_mime.db file looks to be mostly OK. It’s helping me find some issues (font/ttf should be the highest priority result for .ttf, which it isn’t).

However, it looks like the prioritization code I have put in place will break content_type_mime.db in unpleasant ways.

I’m using my translation of the conversion code from your own Rakefile (also in the same tree), but here’s some of the odder diffs:

+bin         application/java-vm                                                       base64          
+txt         application/winhlp                                                        base64          
+t           application/x-troff-man                                                   8bit            
+t           application/x-troff-me                                                    base64          
+t           application/x-troff-ms                                                    base64          

The first should be class, but the code at https://github.com/discourse/mini_mime/blob/main/Rakefile#L77-L80 forces the first extension from application/octet-stream (because application/java-vm no longer sorts first for class).

There are a couple of other examples like this, but I’m trying to figure out what the intent for this particular file is in order to provide (a) recommendations for updates to your own code and (b) convert it correctly myself.

Dominant language
Ruby
Stars
112
Forks
35
Avg merge
1h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from discourse/mini_mime

All issues in discourse/mini_mime

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.