Encode uploaded file slugs
This commit is contained in:
parent
de028e5dd8
commit
1d8a0e639f
@ -52,7 +52,7 @@ class Uploader {
|
|||||||
} while (fs.stat(destPath, (err) => (err ? true : false)));
|
} while (fs.stat(destPath, (err) => (err ? true : false)));
|
||||||
|
|
||||||
fsextra.move(data.file.pathName, destPath).then(() => {
|
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}`;
|
const url = `uploads/${randomName}/${slug}`;
|
||||||
socket.emit("upload:success", url);
|
socket.emit("upload:success", url);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user