mirror of https://github.com/status-im/codimd.git
imageRouter/filesystem: make callback path-independent
Images are now properly served when `config.uploadsPath` differs from its default value. Signed-off-by: WilliButz <wbutz@cyberfnord.de>
This commit is contained in:
parent
556783ffad
commit
12cd747270
|
@ -1,5 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../../logger')
|
||||||
|
@ -15,5 +16,5 @@ exports.uploadImage = function (imagePath, callback) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, url.resolve(config.serverURL + '/', imagePath.match(/public\/(.+)$/)[1]))
|
callback(null, url.resolve(config.serverURL + '/uploads/', path.basename(imagePath)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue