diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-10 17:25:32 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-10 17:25:32 +0100 |
| commit | 3cc9ff370a5e3f5bf321dc56963ae3bc73e75284 (patch) | |
| tree | 194bcafac19e2cc1a77aaab7303d68aafdbbe312 /bucky/util | |
| parent | d9b9383118302aff6d73856175d7362d8b1463c5 (diff) | |
posting new threads and comments working
Diffstat (limited to 'bucky/util')
| -rw-r--r-- | bucky/util/upload.js | 7 |
1 files changed, 4 insertions, 3 deletions
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) { |
