Incorrect path alias and "token" parameter in links

Created on 18 November 2021, about 3 years ago
Updated 20 March 2023, over 1 year ago

Thanks for the module, it almost works )) Well, it switches languages, but the question is how. Or maybe I'm doing something wrong.

1) Frontpage links are generated without the correct alias. For example in my configuration I have /node path as the frontpage. So it is assumed that language links will follow that, but they are not, and here is what I get as frontpage links:

example.com/de/node
example.com/fr/node
example.com/es/node
etc

Yes, the user redirects to a correct URL after all, but I don't think this is the right way.

2) Token parameter is generated for all links: example.com/de/node?token=eMFoZ5rH78KPqL3FmoAz8VHL...

Don't know what it means, but maybe it can break caching? And just looks ugly.

3) It would be great to be able to disable the current language in the menu. The less circular links - the better (links that point to the same page).

Thank you.

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ท๐Ÿ‡บRussia bigboy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yogesh Pawar Pune

    Yogesh Pawar โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yogesh Pawar Pune

    Hi All,

    I have created a patch for this issue which now will not append the token to languages when we flush cache manually from backend.

    I have used the same code tweak mentioned by @bigboy with one additional condition which checks if the token is coming when we really flush the cache.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany FeyP

    Thanks for filing the issue and for the patch. I finally had time to look into this, thanks for your patience.

    The patch will most likely work to remove the token, but it will only fix one symptom of the problem instead of addressing the root of the problem itself. So unfortunately, we need to dig deeper.

    The root cause of the issue is that the menu link derivatives are cached when they shouldn't, so our menu link derivatives aren't regenerated as needed. Currently, core doesn't allow to set correct cache metadata for derivative plugins without patches, so we need to use an entirely different approach. I've attached a patch that always adds one menu link plugin per language in the derivative plugin and then moves the actual link generation to the menu link plugin, where we can actually set correct cache metadata so that the language switch links are actually regenerated when they should be. When we check for access we now also check, if the menu link plugin actually has link information from the language switcher for the language code, so that we only display links that are actually generated by the language switcher service.

    All of this combined should resolve the problems 1) and 2) from the issue summary. It would be great, if you could test the patch and report back whether it works for you.

  • Assigned to Yogesh Pawar
  • Status changed to RTBC almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yogesh Pawar Pune

    @feyp,

    Thanks for the new patch. I have checked the new patch and it does work and solves all the issues.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yogesh Pawar Pune

    Thanks for the new patch. I have checked the new patch and it does work and solves all the issues.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany FeyP

    @Yogesh Pawar Thanks for testing and reviewing the patch and confirming that it works for you. That's really helpful.

    Unfortunately, there was still an unexpected test failure when running tests on Drupal CI, so we can't commit the patch like this.

    I hard a hard time to reproduce this locally. Turns out this happens, because Drupal CI installs Drupal in a subdirectory. Attached is a new patch, which should hopefully fix the test failures.

  • Issue was unassigned.
  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024