mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Set Content-Type from the file type (#11093)
This commit is contained in:
parent
666784f4e5
commit
d63899fc8a
@ -489,7 +489,12 @@ export default {
|
|||||||
asyncUploadFile (file, objectName) {
|
asyncUploadFile (file, objectName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
file.arrayBuffer().then((buffer) => {
|
file.arrayBuffer().then((buffer) => {
|
||||||
this.client.putObject(this.resource.name, objectName, Buffer.from(buffer), file.size, this.uploadMetaData, err => {
|
const metadata = {
|
||||||
|
...this.uploadMetaData,
|
||||||
|
'Content-Type': file.type || 'binary/octet-stream'
|
||||||
|
}
|
||||||
|
|
||||||
|
this.client.putObject(this.resource.name, objectName, Buffer.from(buffer), file.size, metadata, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(this.$notification.error({
|
return reject(this.$notification.error({
|
||||||
message: this.$t('message.upload.failed'),
|
message: this.$t('message.upload.failed'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user