diff options
author | Sheogorath | 2018-12-18 14:52:09 +0100 |
---|---|---|
committer | Sheogorath | 2018-12-18 14:52:18 +0100 |
commit | 0621d7a72d3ed36a120a5b187e2ea07c8dde7c38 (patch) | |
tree | d9794094ddde7e11b06c1954c1ead25c2432ff3d /lib | |
parent | b40f14f66dd5446c1a2a9b20b3065d5c4726c3a8 (diff) |
Fix usage of new URL API
Due to the deprecation of the old `url`-API provided by NodeJS we
replaced `url.resolve` with `url.URL.resolve`, which doesn't exist.
This patch fixes the local filesystem upload of CodiMD by using the new
API correctly. Creating an URL object and using its href.
Some more background:
https://nodejs.org/api/url.html#url_url_href
https://nodejs.org/api/url.html#url_url_resolve_from_to
Fixes https://github.com/hackmdio/codimd/issues/1102
Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/web/imageRouter/filesystem.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/web/imageRouter/filesystem.js b/lib/web/imageRouter/filesystem.js index a2f8700d..7c876d66 100644 --- a/lib/web/imageRouter/filesystem.js +++ b/lib/web/imageRouter/filesystem.js @@ -1,5 +1,5 @@ 'use strict' -const url = require('url') +const URL = require('url').URL const path = require('path') const config = require('../../config') @@ -16,5 +16,5 @@ exports.uploadImage = function (imagePath, callback) { return } - callback(null, url.URL.resolve(config.serverURL + '/uploads/', path.basename(imagePath))) + callback(null, (new URL(path.basename(imagePath), config.serverURL + '/uploads/')).href) } |