api: escape newlines in headline content HTML object

This commit is contained in:
Andrew Dolgov 2023-10-24 21:35:48 +03:00
parent e31636bf97
commit ed43a73369
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
1 changed files with 2 additions and 1 deletions

View File

@ -815,7 +815,6 @@ class API extends Handler {
$headline_row["excerpt"] = $line["content_preview"]; $headline_row["excerpt"] = $line["content_preview"];
if ($show_content) { if ($show_content) {
if ($sanitize_content) { if ($sanitize_content) {
$headline_row["content"] = Sanitizer::sanitize( $headline_row["content"] = Sanitizer::sanitize(
$line["content"], $line["content"],
@ -868,6 +867,8 @@ class API extends Handler {
$hook_object); $hook_object);
$headline_row["content"] = DiskCache::rewrite_urls($headline_row['content']); $headline_row["content"] = DiskCache::rewrite_urls($headline_row['content']);
$headline_row["content"] = str_replace(["\r", "\n"], ["\\r", "\\n"], $headline_row["content"]);
} }
array_push($headlines, $headline_row); array_push($headlines, $headline_row);