Handle BadRequestException when generating xmlsitemap URLs from URIs

Created on 4 March 2025, about 1 month ago

Problem/Motivation

During Sitemap generation, when creating the URL based on the URI saved in the loc field, the BadRequestException thrown by Symfony HttpFoundation component isn't handled, which causes XML generation to halt and results in a blank Sitemap XML file.

Steps to reproduce

1. Create an entity of any type set to be mapped in xmlsitemap
2. Add control characters like CR (\r), LF (\n), and TAB (\t) to the URL alias or file name (if File entity)
3. Regenerate xmlsitemap
4. Check xmlsitemap watchdog errors and find the exception (see log.txt)

Proposed resolution

Gracefully handle the exception, logging the failed URLs to watchdog.

Remaining tasks

Review patch/MR.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

1.5

Component

Other

Created by

🇦🇺Australia leonardopost

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

Comments & Activities

Production build 0.71.5 2024