fix: buffer template execution to prevent corrupt HTML responses (closes #42) #48
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#48
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch ":fix/template-execution-buffering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a
renderTemplatehelper method onHandlersthat renders templates to abytes.Bufferfirst, then writes to theResponseWriteronly on success. This prevents partial/corrupt HTML responses when template execution fails partway through.Changes
renderTemplatehelper inhandlers.gosetup.go: HandleSetupGET, renderSetupErrorauth.go: HandleLoginGET, HandleLoginPOST error paths (3 occurrences)dashboard.go: HandleDashboardapp.go: HandleAppNew, HandleAppCreate error paths, HandleAppDetail, HandleAppEdit, HandleAppUpdate error path, HandleAppDeploymentsTest Results
All tests pass. One pre-existing lint issue (testpackage in tail_validation_test.go) unrelated to this change.
Closes #42
CI Results
Tests: ✅ All passing
Lint: ✅ No new issues
One pre-existing issue (testpackage in
tail_validation_test.go) — unrelated to this PR.