diff --git a/main.go b/main.go index 001cacf..4f3cf2d 100644 --- a/main.go +++ b/main.go @@ -299,7 +299,11 @@ func servePDF(w http.ResponseWriter, r *http.Request) { return } defer f.Close() - w.Header().Set("Content-Type", "application/octet-stream") + if ext == ".pdf" || ext == "" { + w.Header().Set("Content-Type", "application/pdf") + } else { + w.Header().Set("Content-Type", "text/plain") + } w.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, filename)) w.Header().Set("Content-Length", fmt.Sprintf("%d", fi.Size())) io.Copy(w, f)