diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-07 21:04:32 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-07 21:04:32 +0900 |
| commit | a85d5ac4bbfe35652be1bef47f59a79ace7b2c73 (patch) | |
| tree | 42f600708d13f8ff8c12491a052bca78524e4b9d /src/api/common | |
| parent | Display progress (diff) | |
| download | sharkey-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.ts | 7 |
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 }); |