Make apex_entity_url relative

Created on 26 August 2025, about 1 month ago

Problem/Motivation

Currently apex_entity_url is set to absolute. For multi-environment sites and database downstaging strategy this will lead to links pointing from downstream to upstream, so editors can accidentally edit production data.
https://git.drupalcode.org/project/alt_text_validation/-/blob/1.0.x/src/...
https://git.drupalcode.org/project/alt_text_validation/-/blob/1.0.x/src/...

Steps to reproduce

Proposed resolution

Use relative URL for apex_entity_url

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland sokru

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

Comments & Activities

  • Issue created by @sokru
  • 🇺🇸United States swirt Florida

    @sokru thank you for creating this issue.

    I am having trouble reproducing this as a problem. The apex entity url matches (at least in all my uses) matches the full url of the site the report is run on. It does this so that if anyone exports the report to a CSV, the export gives all the info needed. If it used relative links, they would be useless in the CSV.

    When I run the report on my local sandbox, I get links to the local sandbox. When I run the report on prod, I get links to prod.

    I think the issue of the lower environment links pointing to prod only comes up when you copy the database from one environment to another and then do not re-run the report.

    To solve this issue we would need to drop the audit table after a database copy happens. Maybe a cron that looks at the first row in table to see if the urls match the current site, and if not, drops the table.

  • 🇫🇮Finland sokru

    I think the simplest solution would be to convert relative paths to absolute URL's only when exporting the csv-file.

  • 🇺🇸United States swirt Florida

    @sokru that sounds like a good solution.

  • 🇺🇸United States itmaybejj

    Just an FYI from when I was getting reports like this -- if you start converting between absolute and relative you may then run into "excitement" on sites that are served from a subfolder.

Production build 0.71.5 2024