summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Wu2016-12-27 11:52:07 +0800
committerGitHub2016-12-27 11:52:07 +0800
commit9fd5c86b826300bdff2677797d607aa3b9cdf975 (patch)
treea71d794bf9cadf369c498dbe64eda2159192cb0c
parentf2a79f9ade23561c0d3a73db16e5f3590b9f561f (diff)
parenta2fbb3add98060371bdfd37547c5e15de0bdd82c (diff)
Merge pull request #302 from knjcode/url_resolve
Fix URL concatenation when uploading images to local filesystem
-rw-r--r--app.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app.js b/app.js
index c6ee8ace..3246c879 100644
--- a/app.js
+++ b/app.js
@@ -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');
@@ -487,7 +488,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;