Merge pull request #2748 from thelounge/xpaw/fix-2747

Only emit upload url to the client that uploaded the file
This commit is contained in:
Jérémie Astori 2018-09-05 00:16:42 -04:00 committed by GitHub
commit 52ed6f77f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() {