Skip to content

Commit 5368488

Browse files
authored
Merge pull request #941 from filamentphp/fix/rewrite-relative-urls
2 parents 2259e20 + 78f635d commit 5368488

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/Support/Markdown.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ protected function convertSpecialBlockquotes(): static
114114
public function absoluteImageUrls(string $baseUrl): static
115115
{
116116
$this->content = preg_replace(
117-
pattern: '/src=["\'](?!https?:\/\/)([^"\']+)["\'][^>]/i',
118-
replacement: 'src="' . $baseUrl . '$1" ',
117+
pattern: '/\b(src|srcset)\s*=\s*(["\'])(?!https?:\/\/|data:|\/\/)([^"\']+)\2/i',
118+
replacement: '$1=$2' . $baseUrl . '$3$2',
119119
subject: $this->content
120120
);
121121

0 commit comments

Comments
 (0)