Skip to content

fix: preserve empty string values in URL plugin (GH #125)#382

Draft
toddr-bot wants to merge 1 commit intoabw:masterfrom
toddr-bot:koan.toddr.bot/fix-url-empty-args
Draft

fix: preserve empty string values in URL plugin (GH #125)#382
toddr-bot wants to merge 1 commit intoabw:masterfrom
toddr-bot:koan.toddr.bot/fix-url-empty-args

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

@toddr-bot toddr-bot commented Apr 9, 2026

What

Allow empty string values in URL plugin query parameters instead of silently dropping them.

Why

The grep filter in Template::Plugin::URL::new() checks defined && length, which drops params with empty string values (""). Per RFC 3986 and CGI conventions, ?empty=&other=x is valid — an empty value is distinct from an absent parameter. This breaks applications that rely on the presence of a key regardless of its value.

Closes #125.

How

Removed the length check from the grep filter, keeping only the defined check. This matches the fix proposed in the original issue report.

Testing

  • Added test case to t/url.t verifying empty string params are preserved in output
  • Full test suite passes (3209 tests across 117 files)

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 8 insertions(+), 1 deletion(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The URL plugin's grep filter checked both defined() and length(),
dropping params with empty string values. Per RFC 3986, empty query
values are valid (e.g. ?empty=&other=x). Remove the length check
so only undef values are excluded.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.

Empty arguments are incorrectly skipped in Template::Plugin::URL [rt.cpan.org #99522]

1 participant