diff options
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -11,6 +11,7 @@ var compression = require('compression') var session = require('express-session'); var SequelizeStore = require('connect-session-sequelize')(session.Store); var fs = require('fs'); +var url = require('url'); var path = require('path'); var imgur = require('imgur'); var formidable = require('formidable'); @@ -102,7 +103,7 @@ app.use(helmet.hsts({ })); i18n.configure({ - locales: ['en', 'zh', 'fr', 'de', 'ja', 'es', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv'], + locales: ['en', 'zh', 'fr', 'de', 'ja', 'es', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo'], cookie: 'locale', directory: __dirname + '/locales' }); @@ -499,7 +500,7 @@ app.post('/uploadimage', function (req, res) { switch (config.imageUploadType) { case 'filesystem': res.send({ - link: path.join(config.serverurl, files.image.path.match(/^public(.+$)/)[1]) + link: url.resolve(config.serverurl, files.image.path.match(/^public(.+$)/)[1]) }); break; @@ -511,7 +512,7 @@ app.post('/uploadimage', function (req, res) { fs.readFile(files.image.path, function (err, buffer) { var params = { - Bucket: 'hackmd', + Bucket: config.s3bucket, Key: path.join('uploads', path.basename(files.image.path)), Body: buffer }; |