Skip to content

Fix Variable File Extension Matching - #123

Merged
kilo52 merged 1 commit into
masterfrom
fix/replace-var-file-ext
Oct 12, 2026
Merged

kilo52 merged 1 commit into
masterfrom
fix/replace-var-file-ext

Conversation

@kilo52

@kilo52 kilo52 commented Oct 11, 2026

Copy link
Copy Markdown
Member

Fixes a faulty file extension matching in the replace_var() function.

When processing copyright header substitutions by file extension, the replacement logic matched files by path suffix rather than by actual file extension. This caused false-positive matches in any case where one extension is a suffix of another (for example, h matching sh, c matching rc, and similar patterns).

As a result, files can receive a header template intended for a different language, which leads to incorrect comment syntax and invalid or inconsistent generated source content.

Header substitution should apply only to:
Files with an exact extension match.
Exact filename matches when filename-based filtering is used.

This change fixes the wrong matching implementation.

When processing copyright header substitutions by file extension, the replacement logic
matched files by path suffix rather than by actual file extension. This caused false-positive matches in any case where one extension is a suffix of another (for example, h matching sh, c
matching rc, and similar patterns).

As a result, files can receive a header template intended for a different language, which leads
to incorrect comment syntax and invalid or inconsistent generated source content.

Header substitution should apply only to:
Files with an exact extension match.
Exact filename matches when filename-based filtering is used.

This change fixes the wrong matching implementation.

[CL]: Fixed variable file extension matching in replace_var() function. [#122]

Signed-off-by: Phil Gaiser <phil.gaiser@raven-computing.com>
@kilo52 kilo52 self-assigned this Oct 11, 2026
@kilo52 kilo52 added Bug Something isn't working Severity - Medium Partial loss of non-core functionality labels Oct 11, 2026
@kilo52 kilo52 linked an issue Oct 11, 2026 that may be closed by this pull request
@kilo52
kilo52 merged commit 079ea7a into master Oct 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Severity - Medium Partial loss of non-core functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected Copyright Header Substitution

1 participant