mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-16 00:06:41 +00:00
log zlib error message and regex fix (#146)
This commit is contained in:
commit
3effe0d4de
@ -25,7 +25,7 @@ std::vector<char> Comp(std::span<const char> input) {
|
|||||||
reinterpret_cast<const Bytef*>(input.data()),
|
reinterpret_cast<const Bytef*>(input.data()),
|
||||||
static_cast<uLongf>(input.size()));
|
static_cast<uLongf>(input.size()));
|
||||||
if (res != Z_OK) {
|
if (res != Z_OK) {
|
||||||
error("zlib compress() failed: " + std::to_string(res));
|
error("zlib compress() failed (code: " + std::to_string(res) + ", message: " + zError(res) + ")");
|
||||||
throw std::runtime_error("zlib compress() failed");
|
throw std::runtime_error("zlib compress() failed");
|
||||||
}
|
}
|
||||||
debug("zlib compressed " + std::to_string(input.size()) + " B to " + std::to_string(output_size) + " B");
|
debug("zlib compressed " + std::to_string(input.size()) + " B to " + std::to_string(output_size) + " B");
|
||||||
@ -52,7 +52,7 @@ std::vector<char> DeComp(std::span<const char> input) {
|
|||||||
output_buffer.resize(output_buffer.size() * 2);
|
output_buffer.resize(output_buffer.size() * 2);
|
||||||
output_size = output_buffer.size();
|
output_size = output_buffer.size();
|
||||||
} else if (res != Z_OK) {
|
} else if (res != Z_OK) {
|
||||||
error("zlib uncompress() failed: " + std::to_string(res));
|
error("zlib uncompress() failed (code: " + std::to_string(res) + ", message: " + zError(res) + ")");
|
||||||
throw std::runtime_error("zlib uncompress() failed");
|
throw std::runtime_error("zlib uncompress() failed");
|
||||||
} else if (res == Z_OK) {
|
} else if (res == Z_OK) {
|
||||||
break;
|
break;
|
||||||
|
@ -104,7 +104,7 @@ void CoreSend(std::string data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsAllowedLink(const std::string& Link) {
|
bool IsAllowedLink(const std::string& Link) {
|
||||||
std::regex link_pattern(R"(https:\/\/(?:\w+)?(?:\.)?(?:beammp\.com|beammp\.gg|github.com\/BeamMP\/|discord\.gg|patreon\.com\/BeamMP))");
|
std::regex link_pattern(R"(https:\/\/(?:\w+)?(?:\.)?(?:beammp\.com|beammp\.gg|github\.com\/BeamMP\/|discord\.gg|patreon\.com\/BeamMP))");
|
||||||
std::smatch link_match;
|
std::smatch link_match;
|
||||||
return std::regex_search(Link, link_match, link_pattern) && link_match.position() == 0;
|
return std::regex_search(Link, link_match, link_pattern) && link_match.position() == 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user