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 { class Uploader {
constructor(client, socket) { constructor(socket) {
const uploader = new SocketIOFileUploadServer(); const uploader = new SocketIOFileUploadServer();
const folder = path.join(Helper.getFileUploadPath(), ".tmp"); const folder = path.join(Helper.getFileUploadPath(), ".tmp");
@ -46,7 +46,7 @@ class Uploader {
const randomFileName = randomName; const randomFileName = randomName;
const slug = data.file.base; const slug = data.file.base;
const url = `uploads/${randomFileName}/${slug}`; 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); client.clientAttach(socket.id, token);
if (Helper.config.fileUpload.enable) { if (Helper.config.fileUpload.enable) {
new Uploader(client, socket); new Uploader(socket);
} }
socket.on("disconnect", function() { socket.on("disconnect", function() {