Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.4.0: Custom Routes fail because of #6601 #6676

Closed
linusrogge opened this issue Sep 16, 2024 · 2 comments
Closed

v4.4.0: Custom Routes fail because of #6601 #6676

linusrogge opened this issue Sep 16, 2024 · 2 comments
Labels
type: regression 🚨 Is a regression between versions
Milestone

Comments

@linusrogge
Copy link

linusrogge commented Sep 16, 2024

Description

With the new update to v4.4.0, on a multi-language setup, a set of custom routes lead to an ERR_TOO_MANY_REDIRECTS error, thus breaking the site.

Expected behavior
We have two routes, one that checks for the grid-popup template of the opened page, and redirects from /LANG/SLUG to /LANG/popup/SLUG to avoid confusion with other page’s slugs. The second route then returns the page with the desired url. (We’re using swup with the fragment plugin to add this popup page as an overlay above the current page).

[
  'pattern' => '(:any)',
  'language' => '*',
  'action' => function ($language, $slug) {
    $popup = page($slug);
    
    if ($popup AND $popup->intendedTemplate() == 'grid-popup') {
      return go($language . '/popup' . '/' . $popup->slug());
    }

    $this->next();
  }
],
[
  'pattern' => 'popup/(:any)',
  'language' => '*',
  'action' => function ($language, $slug) {
    $popup = page($slug);

    if ($popup AND $popup->intendedTemplate() == 'grid-popup') {
      return site()->visit($popup, $language);
    }
  }
]

To reproduce

  1. Set up a multi-language installation of Kirby
  2. Create the blueprints for the popups (content doesn’t matter) and create example pages right in the root of the content folder (and create the translations, without translating the slugs in other languages)
  3. On the home page, create a link pointing to /LANG/popup/SLUG of one of the popups just created
  4. If clicked, “Too many redirects” error should occur

Your setup

Kirby Version
v4.4.0

Your system (please complete the following information)

  • Device: MacBook Pro 2021 (M1 Pro)
  • OS: MacOS 15.0
  • Browser: Any (Chrome, Safari, Firefox)
  • Version: Any

Additional context
Everything worked fine before updating to v4.4.0, so I figured this will have something to do with the changes made in #6601.

@distantnative distantnative added the type: regression 🚨 Is a regression between versions label Sep 16, 2024
@afbora afbora added this to the 4.4.1 milestone Sep 18, 2024
@bastianallgeier
Copy link
Member

We have a patch release ready that will be released on Monday. You can already give it a try by pulling or downloading https://github.com/getkirby/kirby/tree/release/4.4.1 Please, let us know if the issue has not been fixed by this patch.

@linusrogge
Copy link
Author

@bastianallgeier Can confirm it works using 4.4.1. Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression 🚨 Is a regression between versions
Projects
None yet
Development

No branches or pull requests

4 participants