Skip to content

Commit

Permalink
Avoid parsing URLs multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Apr 15, 2021
1 parent 4dfa6c2 commit 0bc956e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ public function removeBaseUrlFromAbsoluteLinks() {

$linkUrlComponents = \parse_url($row['link']);
if (isset($linkUrlComponents['scheme'])) {
$newLink = \parse_url($row['link'], PHP_URL_PATH);
$sql->set('link', $sql->createNamedParameter($newLink));
$sql->set('link', $sql->createNamedParameter($linkUrlComponents['path']));
}

if (\strpos($row['actions'], 'http') !== false) {
Expand All @@ -345,7 +344,7 @@ public function removeBaseUrlFromAbsoluteLinks() {
foreach ($actions as $index => $action) {
$actionUrlComponents = \parse_url($action['link']);
if (isset($actionUrlComponents['scheme'])) {
$actions[$index]['link'] = \parse_url($action['link'], PHP_URL_PATH);
$actions[$index]['link'] = $actionUrlComponents['path'];
}
}

Expand Down

0 comments on commit 0bc956e

Please sign in to comment.