The "View on git.drupalcode.org" link is wrong

Created on 9 August 2025, 4 days ago

For example, on sqlite.module, the View on git.drupalcode.org link is https://git.drupalcode.org/project/drupal/-/blob/10/core/modules/sqlite/sqlite.module, which is wrong because none of the Drupal branches is 10. A correct link would be https://git.drupalcode.org/project/drupal/-/blob/10.6.x/core/modules/sqlite/sqlite.module, but also https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/modules/sqlite/sqlite.module would work. The latter would not take to the more recent branch, but a .0.x branch is supposed to exist for new Drupal releases.

🐛 Bug report
Status

Active

Version

2.0

Component

User interface

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

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

Comments & Activities

  • Issue created by @apaderno
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    This does not seem to happen for Drupal 11 documentation pages, for example AccessAwareRouter: In that page, the View on git.drupalcode.org link is https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Routing%21AccessAwareRouter.php/class/AccessAwareRouter/11.x.
    It still not the correct link, which should instead be https://git.drupalcode.org/project/drupal/-/blob/11.0.x/core/lib/Drupal/Core/Routing/AccessAwareRouter.php?ref_type=heads, for example, because the 11.x branch is the main branch, not a branch for the Drupal 11 release.

    As a side note, I noticed that the View on git.drupalcode.org link is preceded by an icon, on Drupal 11 pages but not on Drupal 10 or Drupal 9 pages.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Basing on the code used by Formatter::getObjectGitUrl() and Branch::getSlug(), this is probably an issue caused by the slug value stored for each Drupal core branch.

  • First commit to issue fork.
  • @fjgarlin opened merge request.
  • 🇪🇸Spain fjgarlin

    The slug is only used for URL purposes. The title of the branch should be the same as the name of the branch, so the MR should do the trick.

    Since the icon issue was also reported here, I'm providing a fix for it as well. We were overriding a variable and losing the previous value, where the styling library was loaded.

    • fjgarlin committed 5fd08319 on 2.x
      Issue #3540600 by fjgarlin, avpaderno: The "View on git.drupalcode.org"...
  • 🇪🇸Spain fjgarlin

    I've merged this and it will go in the next deployment.

Production build 0.71.5 2024