Skip to content

fix: allow colons in template filenames without PREFIX_MAP (GH #111) - #459

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-colon-in-filenames
Draft

fix: allow colons in template filenames without PREFIX_MAP (GH #111)#459
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-colon-in-filenames

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What

Template filenames containing colons (e.g. report:summary.tt) now work when no PREFIX_MAP is configured.

Why

The colon-prefix parsing in Context::template() and Context::insert() unconditionally splits filenames on the first colon, treating the left side as a PREFIX_MAP key. When no PREFIX_MAP is configured, this causes "no providers for template prefix" errors for any filename containing a colon — making such filenames unusable on non-Windows systems.

How

Gate the colon-prefix regex behind %{ $self->{ PREFIX_MAP } }. When the PREFIX_MAP hash is empty (the default when unconfigured), colons in filenames are treated as literal characters. When PREFIX_MAP has entries, behavior is unchanged.

Testing

  • New t/colon_filename.t — verifies PROCESS and INSERT with colon filenames, and confirms PREFIX_MAP routing still works when configured.
  • Existing t/prefix.t passes unchanged.
  • Full test suite passes.

Fixes #111


Quality Report

Changes: 2 files changed, 101 insertions(+), 17 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

Only parse colon-separated prefixes when PREFIX_MAP has entries.
Previously, any template filename containing a colon (e.g.
'report:summary.tt') would be split on the colon and the prefix
looked up in PREFIX_MAP, even when no PREFIX_MAP was configured.
This caused 'no providers for template prefix' errors for files
with colons in their names.

Now colon parsing is gated behind a check that PREFIX_MAP is
non-empty. When PREFIX_MAP is configured, behavior is unchanged.
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.

Issues with templates that have colons in the filename [rt.cpan.org #76605]

1 participant