如何将基于文本的文件上传到Artifactory,以便它不添加html-header?

时间:2022-01-04 03:03:00

I'm trying to upload a script (sh/perl/python/etc) using:

我正在尝试使用以下命令上传脚本(sh / perl / python / etc):

curl -i -u<username:password> -T file.sh "http://my.server/directory"

and the resultant file in Artifactory has a header of:

并且Artifactory中的结果文件有一个标题:

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

So when I get the script and try to execute it I get an error. Is there a configuration in Artifactory somewhere that stops this change to text based files?

因此,当我得到脚本并尝试执行它时,我收到一个错误。 Artifactory中的某个配置是否会阻止对基于文本的文件进行此更改?

1 个解决方案

#1


1  

I don't expect there's anything wrong with the file upload, and I don't expect the headers exist in the file inside Artifactory. I think the issue occurs when you download the file.

我不认为文件上传有任何问题,我不希望文章存在于Artifactory中的文件中。我认为下载文件时会出现问题。

Your problem appears to be that curl is printing the headers to stdout before printing the file contents, so they all appear in the downloaded file. To avoid this, do not pass -i when downloading the file. If you need to see the headers, you can pass -v, which will print the headers (and other information) to stderr, meaning it will be written to the screen instead of the file.

您的问题似乎是curl在打印文件内容之前将标题打印到stdout,因此它们都出现在下载的文件中。为避免这种情况,请在下载文件时不要传递-i。如果需要查看标题,可以传递-v,它会将标题(和其他信息)打印到stderr,这意味着它将被写入屏幕而不是文件。

#1


1  

I don't expect there's anything wrong with the file upload, and I don't expect the headers exist in the file inside Artifactory. I think the issue occurs when you download the file.

我不认为文件上传有任何问题,我不希望文章存在于Artifactory中的文件中。我认为下载文件时会出现问题。

Your problem appears to be that curl is printing the headers to stdout before printing the file contents, so they all appear in the downloaded file. To avoid this, do not pass -i when downloading the file. If you need to see the headers, you can pass -v, which will print the headers (and other information) to stderr, meaning it will be written to the screen instead of the file.

您的问题似乎是curl在打印文件内容之前将标题打印到stdout,因此它们都出现在下载的文件中。为避免这种情况,请在下载文件时不要传递-i。如果需要查看标题,可以传递-v,它会将标题(和其他信息)打印到stderr,这意味着它将被写入屏幕而不是文件。