Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持 x-oss-server-side-encryption header设置 #715

Closed
chenquincy opened this issue Dec 19, 2019 · 12 comments
Closed

不支持 x-oss-server-side-encryption header设置 #715

chenquincy opened this issue Dec 19, 2019 · 12 comments

Comments

@chenquincy
Copy link

  • Browser Version or Node Version: v11.12.0
  • ali-oss Version: 6.0.2
  • Mini Showcase Repository:
  • Network Resoponse Header x-oss-request-id:

使用 put 方法和 multipartUpload 方法上传文件至私密桶,添加 x-oss-server-side-encryption header 时报错:

InvalidArgumentError: x-oss-server-side-encryption header is not supported for this operation.

但是 文档 中显示是支持的
headers取值:

"headers": {
  "x-oss-server-side-encryption": "KMS"
}
@Pedestrian93
Copy link
Contributor

能贴下详细代码吗

@chenquincy
Copy link
Author

@Pedestrian93
大概代码如下

const uploader = new AliOss({
    bucket,
    accessKeyId,
    accessKeySecret,
    stsToken,
    region,
    timeout: 100000000
})
uploader.put(objectKey, file, {
  headers: {
    "x-oss-server-side-encryption": "KMS"
  }
})

@chenquincy
Copy link
Author

@Pedestrian93
initMultipartUpload 中有说明到 x-oss-server-side-encryption 配置,但是 multipartUpload 中却没有,在使用的时候通过 headers 传递同样会报错。

@Pedestrian93
Copy link
Contributor

Pedestrian93 commented Dec 20, 2019

简单 put 和 initMultipartUpload 应该是支持的

const result = await store.initMultipartUpload(name, {
        headers: {
          'x-oss-server-side-encryption': 'KMS'
        }
      });

@chenquincy
Copy link
Author

@Pedestrian93 那么为什么 multipartUpload 不支持,这应该是个实现上的bug?我看了下源码,multipartUpload 实际上就是几个方法的组合使用,先 initMultipartUpload 再执行上传,特殊 headersinitMultipartUpload 后应该被过滤,后面的步骤不使用,但实际上没有

@chenquincy
Copy link
Author

另外,我在 Node 端使用 put 方法也会报同样的错误,浏览器端没有尝试,但应该也会报错。

Pedestrian93 added a commit to Pedestrian93/ali-oss that referenced this issue Dec 23, 2019
Pedestrian93 added a commit to Pedestrian93/ali-oss that referenced this issue Dec 23, 2019
Pedestrian93 added a commit to Pedestrian93/ali-oss that referenced this issue Dec 24, 2019
@chenquincy
Copy link
Author

@Pedestrian93 能否告知这个问题大概什么时候能发版修复?

@Pedestrian93
Copy link
Contributor

明天可以发布

Pedestrian93 added a commit to Pedestrian93/ali-oss that referenced this issue Dec 24, 2019
@chenquincy
Copy link
Author

@Pedestrian93 我来催更了

@PeterRao
Copy link
Collaborator

@Pedestrian93 我来催更了

代码 还在review

@chenquincy
Copy link
Author

@PeterRao 明天能发版吗

@PeterRao
Copy link
Collaborator

已经发布6.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants