更改内容处置现有S3对象 [英] Change Content-Disposition of existing S3 object

查看:153
本文介绍了更改内容处置现有S3对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在S3 REST API我添加元数据到现有的对象使用PUT(复制)命令和复制关键同一位置'的X AMZ-元数据指令'='REPLACE

In S3 REST API I am adding metadata to an existing object by using the PUT (Copy) command and copying a key to the same location with 'x-amz-metadata-directive' = 'REPLACE'

我想要做的就是通过设置更改下载文件的名称:

What I want to do is change the download file name by setting:

Content-Disposition: attachment; filename=foo.bar;

此正确设置的元数据,但是当我下载文件时,它仍然使用,而不是'foo.bar'

我使用的软件工具S3浏览器来查看元数据和它看起来是正确(除了内容处置为全小写因为这是在S3问我要签名)

I use a software tool S3 Browser to view the metadata and it looks correct (apart from 'Content-Disposition' being all lower case as that's was S3 ask me to sign)

然后使用S3浏览器我只需$ pssed,然后保存在不改变任何东西p $,现在,它的工作原理???

Then using S3 Browser I just pressed, then save without changing anything and now it works???

我缺少的是怎么来设定一个元数据内容处置:附件;文件名= foo.bar; 从我的web应用程序不能正常工作,但是从S3的浏览器工作

What am I missing how come setting a metadata 'Content-Disposition: attachment; filename=foo.bar;' from my web app does not work but does work from S3 Browser?

推荐答案

解决的:

的多科在<一个href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html">http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html

好像是错了,它说:

注意如何'的x amz-'报头进行排序,空白修整,转换与toLowerCase,和多个头具有相同名称使用逗号toseparate值已被加入。

Notice how the 'x-amz-' headers are sorted, white-space trimmed, converted tolowercase, and multiple headers with the same name have been joined using a comma toseparate values.

请注意在Content-Type和Content-MD5HTTPentity头如何只出现在StringToSign .The otherContent- *实体头不。 但是内容处置必须作为具体,而不是设置:X-AMZ-元内容处置

Note how only the Content-Type and Content-MD5HTTPentity headers appear in the StringToSign .The otherContent-* entity headers do not. However Content-Disposition must be set specifically and not included as : x-amz-meta-Content-Disposition

现在工作正常。

这篇关于更改内容处置现有S3对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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