fix: allow colons in template filenames without PREFIX_MAP (GH #111) - #459
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: allow colons in template filenames without PREFIX_MAP (GH #111)#459toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Template filenames containing colons (e.g.
report:summary.tt) now work when noPREFIX_MAPis configured.Why
The colon-prefix parsing in
Context::template()andContext::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
t/colon_filename.t— verifies PROCESS and INSERT with colon filenames, and confirms PREFIX_MAP routing still works when configured.t/prefix.tpasses unchanged.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