Skip to content

Commit 6053aa6

Browse files
committed
Fix protected mod kick
1 parent 0bb18de commit 6053aa6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/TNetwork.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,13 +808,17 @@ void TNetwork::SendFile(TClient& c, const std::string& UnsafeName) {
808808
return;
809809
}
810810
auto FileName = fs::path(UnsafeName).filename().string();
811-
FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName;
812811

813812
for (auto mod : mResourceManager.GetMods()) {
814-
if (mod["filename"] == FileName && mod["protected"] == true)
813+
if (mod["file_name"].get<std::string>() == FileName && mod["protected"] == true) {
814+
beammp_warn("Client tried to access protected file " + UnsafeName);
815+
c.Disconnect("Mod is protected thus cannot be downloaded");
815816
return;
817+
}
816818
}
817819

820+
FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName;
821+
818822
if (!std::filesystem::exists(FileName)) {
819823
if (!TCPSend(c, StringToVector("CO"))) {
820824
// TODO: handle

0 commit comments

Comments
 (0)