From a12c77083b4f0a989c232b40106ff6a331dd2632 Mon Sep 17 00:00:00 2001 From: Vladimir Barinov Date: Sun, 16 Mar 2025 17:57:21 +0300 Subject: [PATCH] fix(links, away) (fixes #1253) --- Web/Models/Entities/Traits/TRichText.php | 8 ++++---- Web/Presenters/AwayPresenter.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Web/Models/Entities/Traits/TRichText.php b/Web/Models/Entities/Traits/TRichText.php index f82626e2..17382dbc 100644 --- a/Web/Models/Entities/Traits/TRichText.php +++ b/Web/Models/Entities/Traits/TRichText.php @@ -41,11 +41,11 @@ trait TRichText return preg_replace_callback( "%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%", (function (array $matches): string { - $href = str_replace("#", "#", $matches[1]); - $href = rawurlencode(str_replace(";", ";", $href)); - $link = str_replace("#", "#", $matches[3]); + $href = rawurlencode($matches[1]); + $href = str_replace("%26amp%3B", "%26", $href); + $link = $matches[3]; # this string breaks ampersands - $link = str_replace(";", ";", $link); + # $link = str_replace(";", ";", $link); $rel = $this->isAd() ? "sponsored" : "ugc"; /*$server_domain = str_replace(':' . $_SERVER['SERVER_PORT'], '', $_SERVER['HTTP_HOST']); diff --git a/Web/Presenters/AwayPresenter.php b/Web/Presenters/AwayPresenter.php index 59993935..2e236d0c 100644 --- a/Web/Presenters/AwayPresenter.php +++ b/Web/Presenters/AwayPresenter.php @@ -20,7 +20,7 @@ final class AwayPresenter extends OpenVKPresenter header("HTTP/1.0 302 Found"); header("X-Robots-Tag: noindex, nofollow, noarchive"); - header("Location: " . $this->queryParam("to")); + header("Location: " . rawurldecode($this->queryParam("to"))); exit; }