补丁文件的正确 mime 类型 [英] Proper mime-type for patch files

查看:88
本文介绍了补丁文件的正确 mime 类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道补丁文件的正确" MIME 类型是什么吗?我一直在使用 application/octet-stream 因为我在 iana.org.应用程序/八位字节流是否正确,还是有其他更适合的东西?为什么没有application/patch类型?

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?

显然,一种可能的答案是text/plain,但我见过许多补丁文件包含非纯文本数据.如果您知道所有内容都是文本,那么 text/plain 是最佳选择,还是在所有补丁文件中保持一致更好?

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?

我应该说我主要考虑的上下文是将 mime-type 设置为颠覆处理行尾的线索(svn:mime-typesvn:eol-style).问题是补丁文件可能会同时对使用 eol-style nativenon-native 的文件进行补丁,这会导致在应用补丁时出现行尾异常结帐后.

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

就其价值而言,Trac(具有良好 svn 支持的票证跟踪器)使用 text/x-patch 用于差异.git.kernel.orgGitHub 使用 text/plain.

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.

这篇关于补丁文件的正确 mime 类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆