@@ -37,18 +37,18 @@ func (h *aliasHandler) content(w http.ResponseWriter, r *http.Request, data *res
37
37
return
38
38
}
39
39
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 {
44
44
header .Set ("Content-Type" , ctype )
45
+ } else if data .Status == http .StatusOK {
46
+ data .Status = http .StatusInternalServerError
45
47
}
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
51
48
}
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 ))
52
52
53
53
w .WriteHeader (data .Status )
54
54
}
0 commit comments