From cfb8b68fc0be1321dcff7b0045a1ef5ce4b7c350 Mon Sep 17 00:00:00 2001 From: celestora Date: Sun, 16 Jan 2022 13:15:08 +0200 Subject: [PATCH] Allow semicolons in links [wip?] Resolves #359 --- Web/Models/Entities/Traits/TRichText.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web/Models/Entities/Traits/TRichText.php b/Web/Models/Entities/Traits/TRichText.php index e3e2ce6d..07caacdc 100644 --- a/Web/Models/Entities/Traits/TRichText.php +++ b/Web/Models/Entities/Traits/TRichText.php @@ -32,10 +32,12 @@ trait TRichText private function formatLinks(string &$text): string { return preg_replace_callback( - "%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},;\"\'<]|\.\s|$)%", + "%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%", (function (array $matches): string { $href = str_replace("#", "#", $matches[1]); + $href = str_replace(";", ";", $matches[1]); $link = str_replace("#", "#", $matches[3]); + $link = str_replace(";", ";", $matches[3]); $rel = $this->isAd() ? "sponsored" : "ugc"; return "$link" . htmlentities($matches[4]);