如何强制从 google 存储桶下载文件而不是用浏览器打开它?

How to force download files from a google storage bucket instead of opening it it browser?

我在 Google 存储桶中有一些音频文件,我在 WordPress 网站上提供指向这些文件的链接。

如何强制下载这些文件而不是在浏览器中播放。

&response-content-disposition=attachment; 添加到 url 的末尾不起作用。

在 gsutil 中尝试过 gsutil setmeta -h 'Content-Disposition:attachment' gs://samplebucket/*/*.mp3 我收到错误

CommandException: Invalid or disallowed header (u'content-disposition).

Only these fields (plus x-goog-meta-* fields) can be set or unset: [u'cache-control', u'content-disposition', u'content-encoding', u'content-language', u'content-type']`

正如 robsiemb 所指出的,我必须在 google 云 shell 下调用这些命令。在我的例子中 Windows shell 结果是罪魁祸首。