如何将基于文本的文件上传到 Artifactory,使其不添加 html-header?
How to I upload a text based file to Artifactory so it doesn't add the html-header?
我正在尝试使用以下方法上传脚本 (sh/perl/python/etc):
curl -i -u<username:password> -T file.sh "http://my.server/directory"
Artifactory 中生成的文件的 header 为:
HTTP/1.1 200 OK
Server: Artifactory/4.2.0
X-Artifactory-Id: 8e3d0483423c1418:-6b134231:162ec3535a99:-8000
Last-Modified: Tue, 08 May 2018 16:54:33 GMT
ETag: a903f23377d76670a1ea646cfaeae8793ba0f975
X-Checksum-Sha1: a903f23377d764470a1ea646cfaeae4f93ba0f975
Accept-Ranges: bytes
X-Checksum-Md5: a6b42e04c9a849772975a46b05718748
X-Artifactory-Filename: file.txt
Content-Disposition: attachment; filename="file.sh"; filename*=UTF-8''file.sh
Content-Type: application/octet-stream
Content-Length: 22982
Date: Tue, 08 May 2018 16:54:51 GMT
因此,当我获取脚本并尝试执行它时,出现错误。 Artifactory 中是否有某个配置可以阻止对基于文本的文件的这种更改?
我不认为文件上传有什么问题,我也不认为 headers 存在于 Artifactory 中的文件中。我认为问题发生在您下载文件时。
您的问题似乎是 curl
在打印文件内容之前将 headers 打印到 stdout
,因此它们都出现在下载的文件中。为避免这种情况,请不要在下载文件时传递 -i
。如果您需要查看 headers,您可以传递 -v
,这会将 headers(和其他信息)打印到 stderr
,这意味着它将被写入屏幕而不是文件。
我正在尝试使用以下方法上传脚本 (sh/perl/python/etc):
curl -i -u<username:password> -T file.sh "http://my.server/directory"
Artifactory 中生成的文件的 header 为:
HTTP/1.1 200 OK
Server: Artifactory/4.2.0
X-Artifactory-Id: 8e3d0483423c1418:-6b134231:162ec3535a99:-8000
Last-Modified: Tue, 08 May 2018 16:54:33 GMT
ETag: a903f23377d76670a1ea646cfaeae8793ba0f975
X-Checksum-Sha1: a903f23377d764470a1ea646cfaeae4f93ba0f975
Accept-Ranges: bytes
X-Checksum-Md5: a6b42e04c9a849772975a46b05718748
X-Artifactory-Filename: file.txt
Content-Disposition: attachment; filename="file.sh"; filename*=UTF-8''file.sh
Content-Type: application/octet-stream
Content-Length: 22982
Date: Tue, 08 May 2018 16:54:51 GMT
因此,当我获取脚本并尝试执行它时,出现错误。 Artifactory 中是否有某个配置可以阻止对基于文本的文件的这种更改?
我不认为文件上传有什么问题,我也不认为 headers 存在于 Artifactory 中的文件中。我认为问题发生在您下载文件时。
您的问题似乎是 curl
在打印文件内容之前将 headers 打印到 stdout
,因此它们都出现在下载的文件中。为避免这种情况,请不要在下载文件时传递 -i
。如果您需要查看 headers,您可以传递 -v
,这会将 headers(和其他信息)打印到 stderr
,这意味着它将被写入屏幕而不是文件。