Skip to content

mimeType validation #5258

@armetiz

Description

@armetiz

Hi there.
I'm dealing with a fatal error for the user.

Users are able to upload files. Those files are captions for videos (.srt).
I have set a mimeTypes validation with value : "text/plain".

I'm not an expert of mimeType detection. But it seems to depend of the file content.
Inside the file, a problem is due to the word "double" caused problem. The mimeType has changed from "text/plain" to "text/x-c", which refers to "C++" file..

You can test with : https://gist.github.com/3349401

So, solutions that I have found :

  • Remove the "double" word..
  • Remove the mimeType detection
  • Add a mimeType detection on "text/plain" and "text/x-c", but what about other "text/*" ?
  • Check only the "first part" of the mimeType.

The latest solution seems to be the coolest one.
As you can see on wikipédia : http://en.wikipedia.org/wiki/Internet_media_type "A media type is composed of two or more parts: A type, a subtype, and zero or more optional parameters."

So, I would like to be able to check mimeTypes with value : "text/*".

This is a crappy case. Any clue are welcome.

Thomas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions