mirror of https://github.com/status-im/codimd.git
Merge pull request #302 from knjcode/url_resolve
Fix URL concatenation when uploading images to local filesystem
This commit is contained in:
commit
9fd5c86b82
3
app.js
3
app.js
|
@ -11,6 +11,7 @@ var compression = require('compression')
|
||||||
var session = require('express-session');
|
var session = require('express-session');
|
||||||
var SequelizeStore = require('connect-session-sequelize')(session.Store);
|
var SequelizeStore = require('connect-session-sequelize')(session.Store);
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var url = require('url');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var imgur = require('imgur');
|
var imgur = require('imgur');
|
||||||
var formidable = require('formidable');
|
var formidable = require('formidable');
|
||||||
|
@ -487,7 +488,7 @@ app.post('/uploadimage', function (req, res) {
|
||||||
switch (config.imageUploadType) {
|
switch (config.imageUploadType) {
|
||||||
case 'filesystem':
|
case 'filesystem':
|
||||||
res.send({
|
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;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue