| 71 | } |
| 72 | |
| 73 | func setContentDisposition(w http.ResponseWriter, r *http.Request, file *files.FileInfo) { |
| 74 | if r.URL.Query().Get("inline") == "true" { |
| 75 | // As per RFC6266 section 4.3 |
| 76 | w.Header().Set("Content-Disposition", "inline; filename*=utf-8''"+url.PathEscape(file.Name)) |
| 77 | } else { |
| 78 | // As per RFC6266 section 4.3 |
| 79 | w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(file.Name)) |
| 80 | w.Header().Set("Content-Type", "application/octet-stream") |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | var rawHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) { |
| 85 | if !d.user.Perm.Download { |