BUG: Template execution errors result in corrupt HTML responses #42
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#42
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Severity: MEDIUM
Files: Multiple handlers (setup.go, app.go, auth.go, dashboard.go)
Description
In all handlers, the pattern is:
The problem:
ExecuteTemplatewrites directly to thehttp.ResponseWriter. If the template partially renders before hitting an error, the HTTP 200 status and partial HTML have already been sent. The subsequenthttp.Error()call:Suggested Fix
Render templates to a buffer first, then write to the response only on success:
This is a common Go web pattern. Consider creating a helper method on Handlers.
do it, using the helper method. apply it in all places this pattern appears. create a PR.