Fix base64 upload issues, bring in patched gridfs-stream

This commit is contained in:
John Lyon-Smith
2018-04-26 07:49:34 -07:00
parent 3ddb9ebc2d
commit 109e9f4d3d
4 changed files with 1131 additions and 1135 deletions

View File

@@ -66,7 +66,6 @@ export class AssetRoutes {
async getAsset(req, res, next) {
const assetId = req.params._id
const file = await this.db.gridfs.findOneAsync({ _id: assetId })
if (!file) {

View File

@@ -6,8 +6,6 @@ import autobind from "autobind-decorator"
import * as Schemas from "./schemas"
import util from "util"
Grid.mongo = mongoose.mongo
@autobind
export class DB {
constructor() {
@@ -20,7 +18,7 @@ export class DB {
autoIndex: !isProduction,
})
this.gridfs = Grid(connection.db)
this.gridfs = Grid(connection.db, mongoose.mongo)
this.gridfs.findOneAsync = util.promisify(this.gridfs.findOne)
this.gridfs.removeAsync = util.promisify(this.gridfs.remove)