From 04a0ce17deed7e6434cb89a70e6869fe1929d913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 19 Nov 2022 23:05:34 +0100 Subject: [PATCH] fix file tranfser access control. --- server/internal/websocket/handler/filetransfer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/internal/websocket/handler/filetransfer.go b/server/internal/websocket/handler/filetransfer.go index 3ceb4d2..8d60680 100644 --- a/server/internal/websocket/handler/filetransfer.go +++ b/server/internal/websocket/handler/filetransfer.go @@ -8,6 +8,10 @@ import ( ) func (h *MessageHandler) FileTransferRefresh(session types.Session) error { + if !h.state.FileTransferEnabled() { + return nil + } + fileTransferPath := h.state.FileTransferPath("") // root // allow users only if file transfer is not locked @@ -16,6 +20,7 @@ func (h *MessageHandler) FileTransferRefresh(session types.Session) error { return nil } + // TODO: keep list of files in memory and update it on file changes files, err := utils.ListFiles(fileTransferPath) if err != nil { return err