Skip to content

Commit

Permalink
print raw file (#903)
Browse files Browse the repository at this point in the history
When adding a `format=raw` to a request `/print`, we receive the raw Content data file in response

Co-authored-by: Keegan Carruthers-Smith <[email protected]>
  • Loading branch information
sinyawskiy and keegancsmith authored Jan 30, 2025
1 parent 3aee1cc commit db0a787
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,13 @@ func (s *Server) servePrintErr(w http.ResponseWriter, r *http.Request) error {

f := result.Files[0]

if qvals.Get("format") == "raw" {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")
_, _ = w.Write(f.Content)
return nil
}

byteLines := bytes.Split(f.Content, []byte{'\n'})
strLines := make([]string, 0, len(byteLines))
for _, l := range byteLines {
Expand Down

0 comments on commit db0a787

Please sign in to comment.