Escape HTML characters for peer_id once to avoid load (#1002)

This commit is contained in:
Cønstantine Kovalensky 2023-10-27 13:01:43 +04:00 committed by GitHub
commit 9dc9453ba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -1223,7 +1223,7 @@ function get_user_torrent_client(string $peer_id): mixed
];
$bestMatchLength = 0;
$peer_id = htmlCHR($peer_id);
foreach ($clients as $key => $clientName) {
if (str_starts_with($peer_id, $key) !== false && strlen($key) > $bestMatchLength) {
$bestMatch = $clientName;