Browse Source

Fix bug where using curl with json headers would return the file instead

pull/144/merge
Andrei Marcu 6 years ago
parent
commit
1fb92ffce3
  1. 2
      display.go

2
display.go

@ -22,7 +22,7 @@ const maxDisplayFileSizeBytes = 1024 * 512
var cliUserAgentRe = regexp.MustCompile("(?i)(lib)?curl|wget")
func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) {
if !Config.noDirectAgents && cliUserAgentRe.MatchString(r.Header.Get("User-Agent")) {
if !Config.noDirectAgents && cliUserAgentRe.MatchString(r.Header.Get("User-Agent")) && !strings.EqualFold("application/json", r.Header.Get("Accept")) {
fileServeHandler(c, w, r)
return
}

Loading…
Cancel
Save