From d913e0f7b245241ed5353a3329791f856dbbfcd8 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 29 Mar 2024 12:29:57 -0400 Subject: [PATCH] fix: seek after mime read --- api/s5/s5.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/s5/s5.go b/api/s5/s5.go index 88bc653..5cf9bbf 100644 --- a/api/s5/s5.go +++ b/api/s5/s5.go @@ -2007,6 +2007,12 @@ func (s *S5API) downloadFile(jc jape.Context) { return } mimeType = detectedType.String() + _, err = file.Seek(0, io.SeekStart) + if err != nil { + s.logger.Error("error seeking file", zap.Error(err)) + _ = jc.Error(err, http.StatusInternalServerError) + return + } } if len(mimeType) == 0 {