Only emit upload url to the client that uploaded the file

Fixes #2747
This commit is contained in:
Pavel Djundik 2018-09-04 12:08:30 +03:00
parent a39f68b4e3
commit 8fa8526698
2 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,7 @@ const whitelist = [
];
class Uploader {
constructor(client, socket) {
constructor(socket) {
const uploader = new SocketIOFileUploadServer();
const folder = path.join(Helper.getFileUploadPath(), ".tmp");
@ -46,7 +46,7 @@ class Uploader {
const randomFileName = randomName;
const slug = data.file.base;
const url = `uploads/${randomFileName}/${slug}`;
client.emit("upload:success", url);
socket.emit("upload:success", url);
});
});

View file

@ -290,7 +290,7 @@ function initializeClient(socket, client, token, lastMessage) {
client.clientAttach(socket.id, token);
if (Helper.config.fileUpload.enable) {
new Uploader(client, socket);
new Uploader(socket);
}
socket.on("disconnect", function() {