From 3cc9ff370a5e3f5bf321dc56963ae3bc73e75284 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 10 Dec 2017 17:25:32 +0100 Subject: posting new threads and comments working --- bucky/util/upload.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bucky/util/upload.js') diff --git a/bucky/util/upload.js b/bucky/util/upload.js index 517d5f7..d92183e 100644 --- a/bucky/util/upload.js +++ b/bucky/util/upload.js @@ -14,6 +14,7 @@ var acceptableuploadTypes = { module.exports = {} module.exports.init = function (opt){ + options = opt s3 = knox.createClient({ key: opt.key, secret: opt.secret, @@ -28,8 +29,8 @@ module.exports.put = function (opt) { var file = opt.file - var types = opt.types || acceptableuploadTypes - var extension = types[file.mimetype] + var types = opt.types + var extension = types && types[file.mimetype] if (opt.preserveFilename) { filename = file.originalname @@ -40,7 +41,7 @@ module.exports.put = function (opt) { var remote_path = "/" + opt.dirname + "/" + filename - if (! extension) { + if (types && ! extension) { err = "Unacceptable filetype." } else if (opt.maxSize && file.size > opt.maxSize) { -- cgit v1.2.3-70-g09d2