The correct mime type for patch files

Does anyone know what the “correct” mime type for patch files is? I use application / octet-stream because I don't see anything better than iana.org . Is the application / octet stream working correctly, or is there something else that works best? Why is there no type "application / patch"?

Obviously, one of the possible answers is "text / plain", but I have seen many patch files that include data that is not purely text. Is text / plain the best choice if you know that all content is text, or is it better to be consistent across all patch files?

I have to say that the context that I am mostly thinking about sets the mime type as the key to subversive string-string processing (svn: mime-type and svn: eol-style). The problem is that the patch file can patch both files that use their own eol style, and also not native, which can lead to erasing the end of the line when applying the patch after checking.

+7
source share
3 answers

I also could not find an authoritarian version. Here are some other possibilities:

  • text/x-diff
  • text/x-patch
  • application/x-patch

Why is Trac (a tracker with good svn support) uses text/x-patch for diffs, and git.kernel.org uses text/plain .

+7
source

I am curious why you are checking patch files on SVN. As an aside, I would agree with the assumption that if you have the opportunity to check the binary patch files for the use of the application / octet stream. I'm not sure what will happen if you accept them ... text for text, octet for binaries ... what is also possible?

0
source

If your patch contains only text, I would prefer text/plain over text/x-patch or text/x-diff . IMO, text/x-patch or -diff more suitable for this purpose and several projects are recommended, but the main reason for text/plain compatibility.

In Gmail, if the attachment is text/plain , clicking on it automatically opens a preview of the document; but it will not be for text/x-patch or text/x-diff . Another example is the Mailman archive interface (a popular mailing list management software): it displays text with text/plain , but not with text/x-patch .

If your patch contains binary data, I would use application/octet-stream , and not because it is correct, but it will save you from problems with line endings.

0
source

All Articles