less copying of files
Ted Unangst tedu@tedunangst.com
Tue, 12 Mar 2024 21:54:58 -0400
1 files changed,
6 insertions(+),
3 deletions(-)
jump to
M
web.go
→
web.go
@@ -2555,9 +2555,12 @@ }
xid := mux.Vars(r)["xid"] preview := r.FormValue("preview") == "1" var media string - var data []byte - row := stmtGetFileData.QueryRow(xid) - err := row.Scan(&media, &data) + var data sql.RawBytes + rows, err := stmtGetFileData.Query(xid) + if err == nil { + defer rows.Close() + err = rows.Scan(&media, &data) + } if err != nil { elog.Printf("error loading file: %s", err) http.NotFound(w, r)