Skip to content

Fix empty IDs for redirects & tracked 404 errors#559

Merged
duncanmcclean merged 5 commits intostatamic:7.xfrom
eminos:fix-empty-error-slugs
May 6, 2026
Merged

Fix empty IDs for redirects & tracked 404 errors#559
duncanmcclean merged 5 commits intostatamic:7.xfrom
eminos:fix-empty-error-slugs

Conversation

@eminos
Copy link
Copy Markdown
Contributor

@eminos eminos commented May 6, 2026

Summary

  • falls back to a deterministic hash-based ID when a tracked 404 URL cannot be slugged
  • keeps existing slug-based IDs for normal URLs
  • adds regression coverage for malformed URLs like /)

Fixes #558.

Testing

  • ./vendor/bin/phpunit tests/Redirects/Stache/ErrorRepositoryTest.php tests/Redirects/RecordErrorTest.php
  • ./vendor/bin/pint --test src/Redirects/Stache/ErrorRepository.php tests/Redirects/Stache/ErrorRepositoryTest.php

@eminos eminos force-pushed the fix-empty-error-slugs branch from fb2d129 to 0ff4275 Compare May 6, 2026 07:51
@duncanmcclean
Copy link
Copy Markdown
Member

duncanmcclean commented May 6, 2026

Thanks! I wonder if we might need to do this in the RedirectRepository too 🤔

(I'm on it)

@eminos
Copy link
Copy Markdown
Contributor Author

eminos commented May 6, 2026

I have no clue Duncan. I stumbled upon this issue on a production site and let Codex investigate, and it came up with this.
Sorry if it's not a perfect PR. I'm thinking better a "90%" PR than no PR at all 🙂
But just let me know if you rather not have these Codex (5.5) generated PRs.

@duncanmcclean
Copy link
Copy Markdown
Member

No worries.

Taking a look now - will merge & tag shortly. Thanks for the pull request!

@duncanmcclean duncanmcclean changed the title Fix empty IDs for tracked 404 errors Fix empty IDs for redirects & tracked 404 errors May 6, 2026
@duncanmcclean duncanmcclean merged commit d145773 into statamic:7.x May 6, 2026
14 checks passed
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.

Tracked 404 errors can fail when URL slug is empty

2 participants