Incorrectly reporting internal routes as entities with Entity Type (target)

Created on 30 July 2025, 4 days ago

Problem/Motivation

The `entity_mesh` module is incorrectly identifying internal Drupal routes, such as `/user/register` or `/user/login`, as entities. It then extracts a "route name" (e.g., "register", "login") and assigns it as the `entity_type`, even though these routes do not correspond to actual entities. This leads to inaccurate data, the `entity_type` should be empty for such non-entity routes.

Steps to reproduce

  1. Install and enable the `entity_mesh` module on a Drupal instance.
  2. Add to a content an internal Drupal route like `/user/register` or `/user/login` (or any other non-entity internal route).
  3. Inspect the data generated or processed by the `entity_mesh` module for these routes.
  4. Observe that `entity_mesh` incorrectly assigns a value to `entity_type` (e.g., "register" for `/user/register`) instead of leaving it empty.

Proposed resolution

The proposed resolution is to modify the `entity_mesh` module's route analysis logic to differentiate between actual entity routes and internal, non-entity routes. For routes that do not correspond to a defined Drupal entity, the `entity_type` should be explicitly set to an empty string or `NULL` to accurately reflect that no entity is associated with the route. This may involve:

  • Implementing a check to determine if a route's path directly maps to an entity type or a specific entity.
  • Utilizing Drupal's route information to identify controller-based routes that are not entity-driven.
  • Refining the pattern matching or regular expressions used to extract the `entity_type` to exclude non-entity patterns.

Remaining tasks

  • Identify the specific code within `entity_mesh` responsible for extracting `entity_type` from routes.
  • Implement the necessary conditional logic to identify and exclude non-entity routes.
  • Write automated tests to ensure the fix correctly handles internal non-entity routes and does not negatively impact legitimate entity routes.
  • Review the patch for code style and adherence to Drupal coding standards.

User interface changes

None. This is a backend data processing fix and does not affect the user interface.

API changes

None. The module's public API will remain unchanged. This is an internal logic correction.

Data model changes

No changes to the module's data model or schema. The change affects only the values populated for existing data fields (specifically, ensuring `entity_type_id` is empty when appropriate).

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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