Skip to content

Commit 12cd747

Browse files
committed
imageRouter/filesystem: make callback path-independent
Images are now properly served when `config.uploadsPath` differs from its default value. Signed-off-by: WilliButz <[email protected]>
1 parent 556783f commit 12cd747

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/web/imageRouter/filesystem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22
const url = require('url')
3+
const path = require('path')
34

45
const config = require('../../config')
56
const logger = require('../../logger')
@@ -15,5 +16,5 @@ exports.uploadImage = function (imagePath, callback) {
1516
return
1617
}
1718

18-
callback(null, url.resolve(config.serverURL + '/', imagePath.match(/public\/(.+)$/)[1]))
19+
callback(null, url.resolve(config.serverURL + '/uploads/', path.basename(imagePath)))
1920
}

0 commit comments

Comments
 (0)