diff --git a/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts b/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts index 7db4f1f7e7..1f6bca8e91 100644 --- a/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts +++ b/packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts @@ -18,6 +18,7 @@ export default class Backblaze implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class Backblaze implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -126,7 +128,7 @@ export default class Backblaze implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts index c920eff6cf..c2f2b2f4c1 100644 --- a/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts +++ b/packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts @@ -18,6 +18,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -116,7 +118,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts index b2e6ed9162..b2be2ec329 100644 --- a/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts +++ b/packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts @@ -18,6 +18,7 @@ export default class OvhCloud implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class OvhCloud implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -116,7 +118,7 @@ export default class OvhCloud implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/s3/S3.ts b/packages/nocodb/src/lib/plugins/s3/S3.ts index d1211ff7a1..8e4f1ea21f 100644 --- a/packages/nocodb/src/lib/plugins/s3/S3.ts +++ b/packages/nocodb/src/lib/plugins/s3/S3.ts @@ -18,6 +18,7 @@ export default class S3 implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -53,11 +54,12 @@ export default class S3 implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -119,7 +121,7 @@ export default class S3 implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts index 66034e020e..005c1e774a 100644 --- a/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts +++ b/packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts @@ -36,7 +36,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); @@ -68,6 +68,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -104,11 +105,12 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { diff --git a/packages/nocodb/src/lib/plugins/spaces/Spaces.ts b/packages/nocodb/src/lib/plugins/spaces/Spaces.ts index 4880b79cb7..599edcee02 100644 --- a/packages/nocodb/src/lib/plugins/spaces/Spaces.ts +++ b/packages/nocodb/src/lib/plugins/spaces/Spaces.ts @@ -18,6 +18,7 @@ export default class Spaces implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class Spaces implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -124,7 +126,7 @@ export default class Spaces implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts b/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts index f549634973..21ffaa4e09 100644 --- a/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts +++ b/packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts @@ -18,6 +18,7 @@ export default class UpoCloud implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class UpoCloud implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -114,7 +116,7 @@ export default class UpoCloud implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', }); diff --git a/packages/nocodb/src/lib/plugins/vultr/Vultr.ts b/packages/nocodb/src/lib/plugins/vultr/Vultr.ts index 2a18f0aeb4..5768e84076 100644 --- a/packages/nocodb/src/lib/plugins/vultr/Vultr.ts +++ b/packages/nocodb/src/lib/plugins/vultr/Vultr.ts @@ -18,6 +18,7 @@ export default class Vultr implements IStorageAdapterV2 { async fileCreate(key: string, file: XcFile): Promise { const uploadParams: any = { ACL: 'public-read', + ContentType: file.mimetype, }; return new Promise((resolve, reject) => { // Configure the file stream and obtain the upload parameters @@ -54,11 +55,12 @@ export default class Vultr implements IStorageAdapterV2 { url: url, encoding: null, }, - (err, _, body) => { + (err, httpResponse, body) => { if (err) return reject(err); uploadParams.Body = body; uploadParams.Key = key; + uploadParams.ContentType = httpResponse.headers['content-type']; // call S3 to retrieve upload file to specified bucket this.s3Client.upload(uploadParams, (err1, data) => { @@ -116,7 +118,7 @@ export default class Vultr implements IStorageAdapterV2 { await waitForStreamClose(createStream); await this.fileCreate('nc-test-file.txt', { path: tempFile, - mimetype: '', + mimetype: 'text/plain', originalname: 'temp.txt', size: '', });