[image_hash_ban] stop putting HTML into exception text, fixes #990

This commit is contained in:
Shish 2024-01-05 13:12:44 +00:00
parent 668e99b140
commit aa494efe45
3 changed files with 4 additions and 4 deletions

View file

@ -82,7 +82,7 @@ class ImageBan extends Extension
$row = $database->get_row("SELECT * FROM image_bans WHERE hash = :hash", ["hash" => $event->hash]); $row = $database->get_row("SELECT * FROM image_bans WHERE hash = :hash", ["hash" => $event->hash]);
if ($row) { if ($row) {
log_info("image_hash_ban", "Attempted to upload a blocked image ({$event->hash} - {$row['reason']})"); log_info("image_hash_ban", "Attempted to upload a blocked image ({$event->hash} - {$row['reason']})");
throw new UploadException("Post ".html_escape($row["hash"])." has been banned, reason: ".format_text($row["reason"])); throw new UploadException("Post {$row["hash"]} has been banned, reason: {$row["reason"]}");
} }
} }

View file

@ -54,7 +54,7 @@ class ResolutionLimit extends Extension
if ($valids > 0 && !$ok) { if ($valids > 0 && !$ok) {
throw new UploadException( throw new UploadException(
"Post needs to be in one of these ratios: ". "Post needs to be in one of these ratios: ".
html_escape($config->get_string("upload_ratios", "")) $config->get_string("upload_ratios", "")
); );
} }
} }

View file

@ -405,10 +405,10 @@ class Upload extends Extension
$headers = fetch_url($url, $tmp_filename); $headers = fetch_url($url, $tmp_filename);
if (is_null($headers)) { if (is_null($headers)) {
log_warning("core-util", "Failed to fetch $url"); log_warning("core-util", "Failed to fetch $url");
throw new UploadException("Error reading from " . html_escape($url)); throw new UploadException("Error reading from $url");
} }
if (filesize($tmp_filename) == 0) { if (filesize($tmp_filename) == 0) {
throw new UploadException("No data found in " . html_escape($url) . " -- perhaps the site has hotlink protection?"); throw new UploadException("No data found in $url -- perhaps the site has hotlink protection?");
} }
// Parse metadata // Parse metadata