Skip to content

fix: drop cHash from generated event detail URLs - #18

Open
maikschneider wants to merge 1 commit into
mainfrom
fix/event-slug-static-requirement
Open

fix: drop cHash from generated event detail URLs#18
maikschneider wants to merge 1 commit into
mainfrom
fix/event-slug-static-requirement

Conversation

@maikschneider

@maikschneider maikschneider commented Aug 20, 2026

Copy link
Copy Markdown
Member

Problem

Every URL generated for the Event Detail plugin carries a cHash, even though the site set ships a route enhancer:

/aktuelles/veranstaltungen/event/1?cHash=cda36610678a2b5fbe60869d18ef2c80

Cause

PageRouter::generateUri() appends a cHash whenever PageArguments::getDynamicArguments() is non-empty. Instrumenting that call showed:

"static":  {"tx_ximatypo3calendar_eventdetail": {"event": "1"}},
"dynamic": {"tx_ximatypo3calendar_eventdetail": {"event_slug": ""}}

event_uid is static via its PersistedAliasMapper aspect. event_slug was not, despite static: event_slug: trueAbstractEnhancer::applyStaticVariables() ends with

$staticVariables = array_intersect_key($staticVariables, $route->getRequirements());

so a static flag for a variable with no requirements entry is silently dropped. event_slug had a defaults entry but no requirement, so it stayed dynamic.

Fix

Add requirements: { event_slug: '[^/]*' }. [^/]* is Symfony's default path-variable pattern widened to allow the empty default, so inbound matching is unchanged.

Verification

Against a real TYPO3 13.4 site (DKFZ intranet, ddev), generated URLs lose the cHash:

before after
event /event/1?cHash=cda366… /event/1
appointment /event/1?cHash=cda366… /event/1

All four documented URL shapes still resolve, each returning HTTP 200:

/event/1               200
/event/1-mein-event    200
/event/1/a1            200
/event/1-mein-event/a1 200
/event/a1              200

README updated to record why the requirement has to sit next to the static flag.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed event links so their static slug remains stable during route generation.
    • Prevented unnecessary cHash parameters from being added to generated event URLs.
  • Documentation

    • Updated frontend routing documentation to describe the event slug constraint.

The event_slug route variable is declared static, but AbstractEnhancer::
applyStaticVariables() intersects the static flags with the route's
requirements and event_slug had none. The flag was silently discarded,
event_slug stayed a dynamic argument, and PageRouter::generateUri()
appended a cHash to every generated event and appointment URL.

Add the missing requirement so the static flag applies.
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ae20446-73af-4fee-8acc-1c35a06db726

📥 Commits

Reviewing files that changed from the base of the PR and between ecefcbb and cdb4431.

📒 Files selected for processing (2)
  • Configuration/Sets/XimaTypo3Calendar/route-enhancers.yaml
  • README.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The route enhancer now requires event_slug to match a non-slash value. The README documents that event_slug needs both a static declaration and a requirement to avoid dynamic treatment and cHash in generated URLs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to cdb44

This localized change removes unnecessary cHash parameters while preserving the documented event URL shapes; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: pipaltree

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing generated event detail URLs from including a cHash.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/event-slug-static-requirement

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pipaltree

Copy link
Copy Markdown
Contributor

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants