Skip to content

fix(template): warn about an absolute rendered path instead of dropping it - #187

Merged
Ilyes512 merged 2 commits into
mainfrom
fix/GH-184-absolute-rendered-paths
Nov 24, 2026
Merged

Ilyes512 merged 2 commits into
mainfrom
fix/GH-184-absolute-rendered-paths

Conversation

@Ilyes512

Copy link
Copy Markdown
Member

Closes #184

Summary

  • Execute renders a path with the template's own separators swapped for a marker, so only a name the template renders empty counts as a conditional skip
  • A value with a leading / now reaches the filepath.IsLocal check from Rendered file names are not bounds-checked: a template can write outside the output directory #183: skipped with a warning for a local template, an error for a cloned one, reported by template validate
  • Docs describe per-segment skipping and replace the conditional-directory example with one that works

Decisions and skipped steps

  • The whole path is still rendered as one template instead of per segment as the issue proposed, so nothing that relied on whole-path rendering changes
  • A value that adds an empty segment (Dir: a//b) used to drop the files silently; the path is now cleaned and written as a/b/x.txt
  • The documented {{ if .UseSonarQube }}docs/images{{ end }}/ example never worked: a directory named {{ if .X }}docs does not parse on its own and is skipped, even when the condition is true. Replaced with {{ if .UseSonarQube }}docs{{ end }}/images/badge.png
  • Not fixed here: a file name that fails to render is dropped silently, and an undefined variable in a name renders as <no value>. Filed as A file name that fails to render is dropped silently, and an undefined variable renders as <no value> #186

…ng it (GH-184)

Execute renders a path with the template's own separators swapped for a marker, so only a name the template renders empty counts as a conditional skip. A value with a leading / now reaches the IsLocal check: skipped with a warning for a local template, an error for a cloned one.
@Ilyes512
Ilyes512 enabled auto-merge November 24, 2026 17:25
@Ilyes512
Ilyes512 merged commit de101e4 into main Nov 24, 2026
8 checks passed
@Ilyes512
Ilyes512 deleted the fix/GH-184-absolute-rendered-paths branch November 24, 2026 17:25
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.

An absolute rendered file name is dropped silently on Unix

1 participant