From f2a648b42998715318934c36d315919fa6563111 Mon Sep 17 00:00:00 2001 From: 2mal3 <56305732+2mal3@users.noreply.github.com> Date: Mon, 19 Jan 2026 21:48:09 +0100 Subject: [PATCH] chore(display): cleaner file download handling (#30) --- display/web/main.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/display/web/main.go b/display/web/main.go index c62d46c..e976847 100644 --- a/display/web/main.go +++ b/display/web/main.go @@ -295,14 +295,7 @@ func downloadFileRoute(ctx echo.Context) error { slog.Info("Serving file for download", "path", fullPath) - file, err := os.Open(fullPath) - if err != nil { - slog.Error("Failed to open file", "file", fullPath, "error", err) - return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to open file"}) - } - defer file.Close() - - return ctx.Stream(http.StatusOK, "application/octet-stream", file) + return ctx.File(fullPath) } func openFileRoute(ctx echo.Context) error {