Anybody know what the "proper" mime-type for patch files would be? I have been using application/octet-stream because I don't see anything better at iana.org. Is application/octet-stream correct, or is there something else that fits better? Why is there no application/patch
type?
Obviously, one possible answer is text/plain
, but I have seen many patch files which include data which is not purely text. Is text/plain
the best choice if you know for a fact all content is text, or is it better to be consistent across all patch files?
I should say the context I am mainly thinking about this in is setting mime-type as a clue to subversion about handling line-endings (svn:mime-type
and svn:eol-style
). The issue is that a patch file may patch both files which use eol-style native
as well as non-native
, which can lead to line-ending weirdness when applying a patch post-checkout.
I couldn't find an authoritative version either. Here's some other possibilities:
text/x-diff
text/x-patch
application/x-patch
For what it's worth, Trac (a ticket tracker with good svn support) uses text/x-patch
for diffs. git.kernel.org and GitHub use text/plain
.
If your patch only contains text, I would prefer text/plain
over text/x-patch
or text/x-diff
. IMO, text/x-patch
or -diff
is more suitable for this purpose, and is recommended by some projects, but the main reason for text/plain
is compatibility.
In Gmail if the attachment is text/plain
, when you click it it will automatically pop up a document preview; but it will not for text/x-patch
or text/x-diff
. Another example is the archive interface of Mailman (a popular mailing list management software): it shows the text with text/plain
, but does not with text/x-patch
.
If your patch contains binary data, I would use application/octet-stream
, not because it is correct but it will save you some trouble from line endings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With