Fix bug where using curl with json headers would return the file instead
This commit is contained in:
parent
c746f70c10
commit
1fb92ffce3
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue