【发布时间】:2018-10-09 05:35:00
【问题描述】:
我有以下 Perl 代码:
$response = $process->request('PATCH',
"https://www.googleapis.com/storage/v1/b/$Bucket/o/$EscapedName",
'{"content-type": "image/jpeg"}',
# '{"metadata": {"Content-Type": "image/jpeg"}}',
{'Content-Type' => 'application/json'});
unless ($response->is_success) {
print "Content-Type: text/plain\n\n";
print $response->status_line . "\n" . $response->decoded_content . "\n" ;
exit;
}
它产生
403 Forbidden
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
尽管我有:
- 存储管理员
- 存储对象管理
- 存储对象创建器
- 存储对象查看器
为我的用户启用。
为什么它不起作用?
简单的对象上传确实有效,但我无法设置此元数据。
【问题讨论】:
-
根据cloud.google.com/storage/docs/json_api/v1/objects/patch,您需要在对象上有
OWNER,但我没有看到任何文档管理员如何包含(或不包含)OWNER... -
或者您可以尝试使用gsutil 工具来编辑元数据吗?