From 6053aa6192a36992192f2365dd8a4d0cbaaa210d Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Tue, 1 Apr 2025 09:11:49 +0200 Subject: [PATCH] Fix protected mod kick --- src/TNetwork.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 06263f5..f576946 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -808,13 +808,17 @@ void TNetwork::SendFile(TClient& c, const std::string& UnsafeName) { return; } auto FileName = fs::path(UnsafeName).filename().string(); - FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName; for (auto mod : mResourceManager.GetMods()) { - if (mod["filename"] == FileName && mod["protected"] == true) + if (mod["file_name"].get() == FileName && mod["protected"] == true) { + beammp_warn("Client tried to access protected file " + UnsafeName); + c.Disconnect("Mod is protected thus cannot be downloaded"); return; + } } + FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName; + if (!std::filesystem::exists(FileName)) { if (!TCPSend(c, StringToVector("CO"))) { // TODO: handle