Skip to content

Commit

Permalink
Merge pull request #2064 from usagov/USAGOV-2069-tome-slashes
Browse files Browse the repository at this point in the history
Usagov 2069 tome slashes
  • Loading branch information
akf authored Nov 19, 2024
2 parents 5fb5bb9 + 5dfcf7d commit 3122d41
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ public function modifyHtml(ModifyHtmlEvent $event) {
public function excludeInvalidPaths(PathPlaceholderEvent $event) {
$path = $event->getPath();

if ($path === '/es/') {
// Tome should never request the spanish homepage with a trailing-slash.
// If it does request it, that is due to the path being linked in content.
// When tome runs, Drupal will redirect the request to `/es`, causing Tome
// to rewrite the contents of `es/index.html` with a refresh redirect.
if ($path !== '/' && str_ends_with($path, '/')) {
// Tome should never request the Spanish homepage or any other local path
// with a trailing-slash. If it does request it, that is because the path
// was found in the content of a node or term.
// For example, when tome runs and it finds a link to `/es/`, Drupal will
// redirect the request for `/es/` to `/es`. The response causes Tome to
// save it in the contents of `es/index.html` with an refresh redirect.
$event->setInvalid();
return;
}
Expand Down

0 comments on commit 3122d41

Please sign in to comment.