Private
Public Access
1
0

Make text/csv inline in the browser
All checks were successful
continuous-integration/drone/push Build is passing

... by using text/plain
https://bugs.chromium.org/p/chromium/issues/detail?id=152911
This commit is contained in:
2023-12-22 09:33:14 -08:00
parent 84523661e2
commit 19c02063e9

View File

@@ -324,8 +324,10 @@ func (srv *Server) historyCSV(ctx context.Context, c echo.Context, history *logs
// log.Info("entries", "count", len(history.LogScores), "out_bytes", b.Len())
c.Request().Header.Set("Cache-Control", "s-maxage=120,max-age=120")
return c.Blob(http.StatusOK, "text/csv", b.Bytes())
c.Response().Header().Set("Cache-Control", "s-maxage=150,max-age=120")
c.Response().Header().Set("Content-Disposition", "inline")
// Chrome and Firefox force-download text/csv files, so use text/plain
// https://bugs.chromium.org/p/chromium/issues/detail?id=152911
return c.Blob(http.StatusOK, "text/plain", b.Bytes())
}