diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-27 08:16:22 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-27 08:16:22 +0300 |
| commit | 734c7fbd89241133499a88674d5cf62de2ca1469 (patch) | |
| tree | 90aa48f5f892903a059b56e075e81821bcbda998 /internal/processor/processor.go | |
| parent | 371c54cb5ad3793cf4b61e7451b0710d317021d6 (diff) | |
fix(generator): write to temp file, check close error, rename on success
Fixes data loss risk in writePage:
- Write to a temp file instead of the target path.
- Explicitly close the temp file and check the error (was ignored).
- Rename to the final path only after successful close.
- Remove the temp file on any error so truncated output is never left on disk.
Added TestWritePage (happy path + template error) and
TestWritePage_tempFileCleanedOnError to verify no corruption of existing file.
Diffstat (limited to 'internal/processor/processor.go')
0 files changed, 0 insertions, 0 deletions
