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

我用obsClient.getObject 下载文件时,重写 ResponseContentDisposition没有用 #12

Open
zixinhmc opened this issue Aug 7, 2021 · 3 comments

Comments

@zixinhmc
Copy link

zixinhmc commented Aug 7, 2021

您好,我希望在下载的时候指定一个文件名,我给ResponseContentDisposition属性赋值,没有用

obsClient.getObject({
        Bucket: '',
        Key: '',
        ResponseContentDisposition: 'attachment; file=1.jpg',
        ResponseContentType: 'application/octet-stream',
        SaveByType: "file",

    }

返回的请求

image

我需要怎么设置呢

@noaccident
Copy link
Collaborator

对此很抱歉,这边需要找服务端确认一下,如果有新的进展会及时回复的。谢谢你的理解

@noaccident
Copy link
Collaborator

不好意思久等了,经定位SDK下载文件重命名确实有问题,该问题会尽快修复,感谢您的反馈。这边你可以使用以下demo来规避:

const { SignedUrl } =obsClient.createSignedUrlSync({
    Method : 'GET', 
    Bucket : '', 
    Key : '403.PNG', 
    QueryParams: {
        'response-content-disposition': 'attachment;filename=1.jpg',
        // ResponseContentType: 'application/octet-stream',
    }
})
console.log(SignedUrl)

@cnwhy
Copy link

cnwhy commented Aug 24, 2022

@noaccident 这么久了服务端那边还没解决么,你提供的规避方法,不支持中文文件名。

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