MCPcopy
hub / github.com/filebrowser/filebrowser / setContentDisposition

Function setContentDisposition

http/raw.go:73–82  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, file *files.FileInfo)

Source from the content-addressed store, hash-verified

71}
72
73func 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
84var rawHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
85 if !d.user.Perm.Download {

Callers 5

previewHandlerFunction · 0.85
raw.goFile · 0.85
rawFileHandlerFunction · 0.85
subtitleFileHandlerFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by 1