False positives for broken links when Drupal base path is not root

Created on 20 June 2025, 26 days ago

Problem/Motivation

When Drupal is served from a subdirectory (i.e., the base path is not /, for example, /corporative), the Entity Mesh module incorrectly reports broken links for internal URLs. The module seems to be including the base path in its URL processing, leading to false positives when validating links that are inherently correct relative to the site's root.

Steps to reproduce

  1. Set up a Drupal site where the base path is not the root (e.g., install Drupal in a subdirectory like public_html/corporative and configure the web server accordingly, or use $base_url in settings.php to reflect the subdirectory).
  2. Ensure the entity_mesh module is installed and enabled.
  3. Create content with internal links (e.g., links to other nodes or entities) using relative paths.
  4. Run a broken link checker or observe the Entity Mesh's reporting of broken links.
  5. Notice that links that are valid when accessed directly in the browser (considering the base path) are flagged as broken by entity_mesh.

Proposed resolution

The proposed resolution is to modify the way entity_mesh processes URLs. If the Drupal base path is not /, the module should strip or ignore this base path segment when resolving or validating internal links. This would ensure that the module's link validation accurately reflects the actual accessibility of the links within the Drupal installation, preventing false positives.

Specifically, when working with a URL, first determine if the site's base path is present at the beginning of the URL string. If it is, remove that base path segment before proceeding with link validation or entity resolution.

Remaining tasks

  • Write a patch to implement the proposed resolution.
  • Add automated tests to cover this specific scenario (Drupal base path not being / and its effect on link validation).
  • Review and commit the patch.
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain Juanjol Navarra

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024