summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliButz2018-09-26 20:40:28 +0200
committerWilliButz2018-09-26 20:55:15 +0200
commit12cd74727065079905cb385119d7a2db35276cca (patch)
treed5d0ce23e5bd76606162cb846a897a827578c5c3
parent556783ffad2e26c490c0d9d9520d7ee13a750dbb (diff)
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>
Diffstat (limited to '')
-rw-r--r--lib/web/imageRouter/filesystem.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/web/imageRouter/filesystem.js b/lib/web/imageRouter/filesystem.js
index 4bf82b31..8c432b0c 100644
--- a/lib/web/imageRouter/filesystem.js
+++ b/lib/web/imageRouter/filesystem.js
@@ -1,5 +1,6 @@
'use strict'
const url = require('url')
+const path = require('path')
const config = require('../../config')
const logger = require('../../logger')
@@ -15,5 +16,5 @@ exports.uploadImage = function (imagePath, callback) {
return
}
- callback(null, url.resolve(config.serverURL + '/', imagePath.match(/public\/(.+)$/)[1]))
+ callback(null, url.resolve(config.serverURL + '/uploads/', path.basename(imagePath)))
}