Skip to content

Commit

Permalink
fix: double escape in link content
Browse files Browse the repository at this point in the history
We already escape the entire content and don't need to escape the link content a second time. Otherwise, when a link contains, for example, an apostrophe, it's double encoded to &pos; before being displayed on the page.
  • Loading branch information
Roardom committed Jan 21, 2025
1 parent 90d2741 commit ba39061
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Helpers/Bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function parse(?string $source, bool $replaceLineBreaks = true): string
);
$source = preg_replace_callback(
'/\[url=(.*?)](.*?)\[\/url]/i',
fn ($matches) => '<a href="'.$this->sanitizeUrl($matches[1]).'">'.e($matches[2]).'</a>',
fn ($matches) => '<a href="'.$this->sanitizeUrl($matches[1]).'">'.$matches[2].'</a>',
$source ?? ''
);
$source = preg_replace_callback(
Expand Down

0 comments on commit ba39061

Please sign in to comment.