From 56af6fc1f82b26246e16c56d4d781435be23b0e4 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 21 Jan 2021 20:58:40 -0800 Subject: [PATCH] Correctly abort on file missing without panic --- router/router_server_files.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/router/router_server_files.go b/router/router_server_files.go index 9679e17..44e315b 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -30,6 +30,7 @@ func getServerFileContents(c *gin.Context) { f, st, err := s.Filesystem().File(p) if err != nil { middleware.CaptureAndAbort(c, err) + return } defer f.Close() @@ -48,6 +49,7 @@ func getServerFileContents(c *gin.Context) { // take since a panic will at least be recovered and this should be incredibly // rare? middleware.CaptureAndAbort(c, err) + return } }