summaryrefslogtreecommitdiff
path: root/src/api/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-07 21:04:32 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-07 21:04:32 +0900
commita85d5ac4bbfe35652be1bef47f59a79ace7b2c73 (patch)
tree42f600708d13f8ff8c12491a052bca78524e4b9d /src/api/common
parentDisplay progress (diff)
downloadsharkey-a85d5ac4bbfe35652be1bef47f59a79ace7b2c73.tar.gz
sharkey-a85d5ac4bbfe35652be1bef47f59a79ace7b2c73.tar.bz2
sharkey-a85d5ac4bbfe35652be1bef47f59a79ace7b2c73.zip
#882
Diffstat (limited to 'src/api/common')
-rw-r--r--src/api/common/add-file-to-drive.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts
index e1baf08191..a96906d291 100644
--- a/src/api/common/add-file-to-drive.ts
+++ b/src/api/common/add-file-to-drive.ts
@@ -13,13 +13,13 @@ import { Duplex } from 'stream';
const log = debug('misskey:register-drive-file');
-const addToGridFS = (name, binary, metadata): Promise<any> => new Promise(async (resolve, reject) => {
+const addToGridFS = (name, binary, type, metadata): Promise<any> => new Promise(async (resolve, reject) => {
const dataStream = new Duplex();
dataStream.push(binary);
dataStream.push(null);
const bucket = await getGridFSBucket();
- const writeStream = bucket.openUploadStream(name, { metadata });
+ const writeStream = bucket.openUploadStream(name, { contentType: type, metadata });
writeStream.once('finish', (doc) => { resolve(doc); });
writeStream.on('error', reject);
dataStream.pipe(writeStream);
@@ -144,10 +144,9 @@ export default (
}
// Create DriveFile document
- const file = await addToGridFS(name, data, {
+ const file = await addToGridFS(name, data, mime, {
user_id: user._id,
folder_id: folder !== null ? folder._id : null,
- type: mime,
comment: comment,
properties: properties
});