Skip to content

Commit

Permalink
Fix for illegal offset scheme errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Dec 8, 2017
1 parent 70f6529 commit 6628bbb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# v1.3.11
## mm/dd/2017

1. [](#bugfix)
* Fixed issue with _illegal scheme offset_ in `Uri::convertUrl()` [page-inject#8](https://github.com/getgrav/grav-plugin-page-inject/issues/8)

# v1.3.10
## 12/06/2017

1. [](#bugfix)
* Reverted GPM Local pull request as it broken admin [#1742](https://github.com/getgrav/grav/issues/1742)

1. [](#new)

# v1.3.9
## 12/05/2017

Expand Down
11 changes: 6 additions & 5 deletions system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public static function convertUrl(Page $page, $url, $type = 'link', $absolute =
}

// handle absolute URLs
if (!$external && ($absolute === true || $grav['config']->get('system.absolute_urls', false))) {
if (is_array($url) && !$external && ($absolute === true || $grav['config']->get('system.absolute_urls', false))) {

$url['scheme'] = $uri->scheme(true);
$url['host'] = $uri->host();
Expand Down Expand Up @@ -983,17 +983,18 @@ public static function convertUrl(Page $page, $url, $type = 'link', $absolute =
}
}

// Handle route only
if ($route_only) {
$url_path = str_replace($base_url, '', $url_path);
}

// transform back to string/array as needed
if (is_array($url)) {
$url['path'] = $url_path;
} else {
$url = $url_path;
}

if ($route_only) {
$url = str_replace($base_url, '', $url);
}

return $url;
}

Expand Down

0 comments on commit 6628bbb

Please sign in to comment.