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

This commit is contained in:
Andrei Marcu 2019-01-14 15:23:37 -08:00
parent c746f70c10
commit 1fb92ffce3
1 changed files with 1 additions and 1 deletions

View File

@ -22,7 +22,7 @@ const maxDisplayFileSizeBytes = 1024 * 512
var cliUserAgentRe = regexp.MustCompile("(?i)(lib)?curl|wget") var cliUserAgentRe = regexp.MustCompile("(?i)(lib)?curl|wget")
func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) { 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) fileServeHandler(c, w, r)
return return
} }