josevalim

josevalim

Creator of Elixir

Hi everyone,

I have started working on the v2 version of the Mime library, used by Plug and Phoenix. The previous version depended on an external Mime database, which made it complicated for us to handle corner cases and, often times, it was too large.

The new version starts a new database from scratch, which should be faster to compile, faster to run, and use less memory. However, it may be missing important mime types. Therefore, I would like to request the community help in two possible ways:

  1. Compare the list of supported extensions with the files you have in priv/static (or assets/static). Are all extensions listed? If not, please send a PR to add unsupported extensions.

  2. Use mime master as a dependency in your project and see if anything fails:

     {:mime, "~> 2.0", github: "elixir-plug/mime", override: true}
    

Your feedback is deeply appreciated!

Showing Posts 15 to 6

josevalim

josevalim OP

Creator of Elixir

Hrm, so we need to see how the mime types are being parsed by Plug. Perhaps it rejects or discards what is after the question mark.

altdsoy

altdsoy

Yes, I did. Double checked ervery time. Running after each change: mix deps.clean mime --build

The MIME that is using the semicolon separated version does not work (I mean the plug :accepts, ["v1"] errors kicks in with a 406 response (which is the expected behavior for a not compatible type, right?)

The one without the semicolon works as expected.

josevalim

josevalim OP

Creator of Elixir

Just to be sure: did you force MIME to be recompiled so it picks your changes?

altdsoy

altdsoy

Hello José, did you mean setting the types in the config :mime, :types (as it’s suppose to be done)?

Maybe, I was a bit confusing, sorry for that. I meant that I was able to define my own type using the following:

config :mime, :types,
  "application/vnd.example.v1+json" => ["v1"],
  "application/vnd.example.v2+json" => ["v2"]
}

However, It seems that the below version does not work, and it was basically my question (just wanted to be sure it doesn’t work as a MIME type):

config :mime, :types,
  "application/vnd.example+json;version=1" => ["v1"],
  "application/vnd.example+json;version=2" => ["v2"]
}

The way I tested it was to using a plug :accepts and it’s only working without the ;version=1.

Anyway, thank you for your time.

josevalim

josevalim OP

Creator of Elixir

There is a mechanism for you to define additional types. I think you will need to define each version as its own mime type.

altdsoy

altdsoy

Hello!

Does it handle custom MIME with versioning?
For example, the both example below are valid values:

Accept: application/vnd.example.v1+json
Accept: application/vnd.example+json;version=1.0

However, it seems the second one is not working with MIME… Or maybe I’m doing something wrong?

josevalim

josevalim OP

Creator of Elixir

Thanks for the follow up and don’t worry about this. :slight_smile: Get better!

BartOtten

BartOtten

Got RSI, so spend so time off keyboard, hence the late reply.

Did not encounter any issues with importing it as a dep; didn’t find any files in priv/static not listed.

Found a small list in my code (which only checks for ‘zip’, image’ and ‘xml’) with a few Mime-types returned in content-type header. Those may not be ‘standard’ (hence my custom list) but maybe they are used more often. The mentioned RSI prevents me from investigating.

application.zip
application/x-zip-compressed
f0rest8

f0rest8

On my phone so apologies if I’m missing it, but is the InDesign file extension .ind included?

I see the .ps, .eps, .ai but I haven’t noticed the .ind yet.

Again, I’m on my phone so I might just be missing it when I look.

Update: maybe .ind was never supported and the preference is just to use .ai?

josevalim

josevalim OP

Creator of Elixir

Please send a PR so text/javascript prevails but we should still recognize other formats.

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews