Skip to content

Commit

Permalink
Use URI rather than URL for redirect destination.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Sep 22, 2022
1 parent a5d2efd commit c63da40
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/quant_tome/src/QuantTomeBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,15 @@ public function checkRequiredFiles(&$context) {
while (!feof($handle)) {
$line = fgets($handle);
$redirect = explode(' ', $line);
if (empty($redirect[0])) {
$source = trim($redirect[0]);
if (empty($source)) {
break;
}
// Only use the destination URI.
$destination = parse_url(trim($redirect[1]), PHP_URL_PATH);
$queue->createItem(new RedirectItem([
'source' => trim($redirect[0]),
'destination' => trim($redirect[1]),
'source' => $source,
'destination' => $destination,
'status_code' => 301,
]));
}
Expand All @@ -179,13 +182,13 @@ public function checkRequiredFiles(&$context) {
}

/**
* Convert the path to a URI used by Quant.
* Convert the path to a URI.
*
* @param string $file_path
* The file path.
*
* @return string
* URI based on file path.
* URI based on the file path.
*/
public function pathToUri($file_path) {
// Strip directory and index.html to match regular Quant processing.
Expand Down

0 comments on commit c63da40

Please sign in to comment.