Skip to content

Commit

Permalink
Fix in creating URLs (they can be url encoded).
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopetkov committed Oct 15, 2020
1 parent ca0c7ad commit 618dd4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ static function updatePageIndex(string $path): void
return;
}
$app = App::get();
$result = self::makeRequest($app->urls->get($path));
$url = $app->request->base . $path; // Dont use $app->urls->get() because the path may be encoded already
$result = self::makeRequest($url);
if ($result['status'] === 200) {
$dom = new HTML5DOMDocument();
$dom->loadHTML($result['content'], HTML5DOMDocument::ALLOW_DUPLICATE_IDS);
Expand Down Expand Up @@ -180,7 +181,7 @@ static function search(string $query, int $limit = 20, int $page = 1): ?array
$index = 0;
$resultsOrder = [];
foreach ($items as $item) {
$url = isset($item->path) ? $app->urls->get($item->path) : (isset($item->url) ? $item->url : $app->urls->get()); // compatibility with an old version
$url = isset($item->path) ? $app->request->base . $item->path : (isset($item->url) ? $item->url : $app->request->base . '/'); // compatibility with an old version
$title = $item->title;
$content = $item->content;
$loweredTitle = mb_strtolower($title);
Expand Down

0 comments on commit 618dd4a

Please sign in to comment.