Fixed remote URLs in markdown if using subfolder setup

This commit is contained in:
Matias Griese
2022-04-08 20:13:29 +03:00
parent f3e20dd4cd
commit ae3465646c
2 changed files with 10 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
3. [](#bugfix)
* Fixed locking and reading files using `Framework\File` classes
* Fixed `Utils::resolveTokenPath()` with `@variable@` not working properly
* Fixed remote URLs in markdown if using subfolder setup
# v1.7.33
## mm/dd/2022

View File

@@ -97,6 +97,10 @@ class Excerpts
{
$grav = Grav::instance();
$url = htmlspecialchars_decode(rawurldecode($excerpt['element']['attributes']['href']));
if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) {
return $excerpt;
}
$url_parts = $this->parseUrl($url);
// If there is a query, then parse it and build action calls.
@@ -185,7 +189,12 @@ class Excerpts
*/
public function processImageExcerpt(array $excerpt): array
{
$grav = Grav::instance();
$url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['src']));
if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) {
return $excerpt;
}
$url_parts = $this->parseUrl($url);
$media = null;
@@ -196,7 +205,6 @@ class Excerpts
$media = $this->page->getMedia();
} else {
$grav = Grav::instance();
/** @var Pages $pages */
$pages = $grav['pages'];