From 7dc0bbd7b26ef50ebd6c0a4d719658c2d288c2d3 Mon Sep 17 00:00:00 2001 From: Romulus Urakagi Tsai Date: Wed, 6 May 2020 11:15:01 +0800 Subject: Set correct storage location --- server/migrations.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/migrations.js b/server/migrations.js index 33f061f5..b02ca246 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -1048,7 +1048,11 @@ Migrations.add('change-attachment-library', () => { const bucket = new MongoInternals.NpmModule.GridFSBucket(MongoInternals.defaultRemoteCollectionDriver().mongo.db, {bucketName: 'cfs_gridfs.attachments'}); const gfsId = new MongoInternals.NpmModule.ObjectID(file.copies.attachments.key); const reader = bucket.openDownloadStream(gfsId); - const path = `/var/attachments/${file.name()}`; + let store = Attachments.storagePath(); + if (store.charAt(store.length - 1) === '/') { + store = store.substring(0, store.length - 1); + } + const path = `${store}/${file.name()}`; const fd = fs.createWriteStream(path); reader.pipe(fd); let opts = { -- cgit v1.2.3-1-g7c22