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
+1129 -1130
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -31,7 +31,7 @@
"cors": "^2.8.3",
"credential": "^2.0.0",
"express": "^4.15.2",
"gridfs-stream": "^1.1.1",
"gridfs-stream": "jlyonsmith/gridfs-stream",
"handlebars": "^4.0.10",
"http-errors": "^1.6.1",
"json5": "^0.5.1",
-1
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) {
+1 -3
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)