@@ -37,18 +37,18 @@ func (h *aliasHandler) content(w http.ResponseWriter, r *http.Request, data *res
3737 return
3838 }
3939
40- ctype , err := util . GetContentType ( item . Name (), file )
41- if err == nil {
42- header . Set ( "Accept-Ranges" , "bytes" )
43- if len ( header . Values ( "Content-Type" )) == 0 {
40+ header . Set ( "Accept-Ranges" , "bytes" )
41+ if len ( header . Values ( "Content-Type" )) == 0 {
42+ ctype , err := util . GetContentType ( item . Name (), file )
43+ if err == nil {
4444 header .Set ("Content-Type" , ctype )
45+ } else if data .Status == http .StatusOK {
46+ data .Status = http .StatusInternalServerError
4547 }
46- header .Set ("Content-Length" , strconv .FormatInt (item .Size (), 10 ))
47- header .Set ("Date" , time .Now ().UTC ().Format (http .TimeFormat ))
48- header .Set ("Last-Modified" , item .ModTime ().UTC ().Format (http .TimeFormat ))
49- } else if data .Status == http .StatusOK {
50- data .Status = http .StatusInternalServerError
5148 }
49+ header .Set ("Content-Length" , strconv .FormatInt (item .Size (), 10 ))
50+ header .Set ("Date" , time .Now ().UTC ().Format (http .TimeFormat ))
51+ header .Set ("Last-Modified" , item .ModTime ().UTC ().Format (http .TimeFormat ))
5252
5353 w .WriteHeader (data .Status )
5454}
0 commit comments