我正在使用Trello API将文件上传(并附加)到卡上。当附件通过API上传时,Trello附件服务错误Content-Type
我发表的帖子中https://api.trello.com/1/cards/my-card-id/attachments
邮件正文是JSON
{ file: file_contents, 'BuildSheet.html': filename, mimeType: 'text/html' }
file_contents is a string that contains the body of the file I want to attach.
工程。该文件被上传并附加。当我获取卡片数据时,这是我看到的有关此附件的内容。
{"id":"58a496bc751c0c2fa260630f",
"bytes":3291,
"date":"2017-0215T17:58:20.881Z",
"edgeColor":null,
"idMember":"55240806b8ca85db897253c4",
"isUpload":true,
"mimeType":"text/html",
"name":"BuildSheet.html",
"previews":[],
"url":"https://trello-attachments.s3.amazonaws.com/589ca323806c1d80cc03ea12/589ceda619d5936e8428f15b/1f62074b6700e61e611a90beaa8c2c73/Upload"}
您可以看到mimeType设置正确。名字也是正确的。但是,如果您从UI内部上传,则url不会像使用该文件一样。所以该文件没有.html扩展名。
当我下载的文件,它包含了这个头
Content-Type: application/octet-stream
它应该是text/html的。这会导致浏览器下载文件而不是显示它。
我做错了什么?有没有其他人有这个问题?
此外,有什么办法让Trello在构建url时使用文件名?