Skip to content

fix: use xml_escape() in Stream.pm instead of manual regex escaping#292

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-issue-280
Draft

fix: use xml_escape() in Stream.pm instead of manual regex escaping#292
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-issue-280

Conversation

@toddr-bot

@toddr-bot toddr-bot commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stream.pm's Start handler manually applied four regex substitutions to escape XML special characters in attribute values, duplicating the logic already available in Expat.pm::xml_escape(). Replaced the four manual regexes with a single $expat->xml_escape($val, '>', '"') call.

Fixes #280

Changes

  • Replace 4 manual regex substitutions (lines 31-34) with one xml_escape() call
  • Net change: -5 lines, +1 line

Test plan

  • Existing t/stream_attr_escape.t covers ampersand, quote, and angle bracket escaping in Stream attribute values
  • Full test suite passes (63 files, 727 tests)

Generated by Kōan /fix


Quality Report

Changes: 1 file changed, 1 insertion(+), 5 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The Start handler manually applied four regex substitutions to escape
XML special characters in attribute values (&, <, >, "). This
duplicated the logic in Expat.pm's xml_escape() method. Replace with
a single call to $expat->xml_escape($val, '>', '"'), which always
escapes & and < and accepts additional characters as arguments.

Fixes #280

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.54%. Comparing base (ab2416c) to head (7a530f8).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
+ Coverage   76.40%   76.54%   +0.14%     
==========================================
  Files           1        1              
  Lines        1102     1113      +11     
  Branches      346      351       +5     
==========================================
+ Hits          842      852      +10     
  Misses         52       52              
- Partials      208      209       +1     
Flag Coverage Δ
perl 76.54% <ø> (+0.14%) ⬆️
xs 76.54% <ø> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a28ad1...7a530f8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

duplication: Stream.pm Start handler reimplements XML attribute escaping

1 participant