From 1d8a0e639ff796609f59e11e7f3893a66601c5fe Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Oct 2018 00:23:41 +0300 Subject: [PATCH] Encode uploaded file slugs --- src/plugins/uploader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/uploader.js b/src/plugins/uploader.js index eb887742..0dff113f 100644 --- a/src/plugins/uploader.js +++ b/src/plugins/uploader.js @@ -52,7 +52,7 @@ class Uploader { } while (fs.stat(destPath, (err) => (err ? true : false))); fsextra.move(data.file.pathName, destPath).then(() => { - const slug = path.basename(data.file.pathName); + const slug = encodeURIComponent(path.basename(data.file.pathName)); const url = `uploads/${randomName}/${slug}`; socket.emit("upload:success", url); }).catch(() => {