FIX: mime-type returning only octet-stream
This commit is contained in:
parent
0065861eab
commit
fccba73bac
1 changed files with 3 additions and 1 deletions
4
main.go
4
main.go
|
|
@ -154,7 +154,9 @@ func main() {
|
||||||
mimeType := "application/octet-stream"
|
mimeType := "application/octet-stream"
|
||||||
extPos := strings.LastIndex(info.Name(), ".")
|
extPos := strings.LastIndex(info.Name(), ".")
|
||||||
if extPos != -1 {
|
if extPos != -1 {
|
||||||
mimeType = mime.TypeByExtension(info.Name()[:extPos])
|
if m := mime.TypeByExtension(info.Name()[extPos:]); m != "" {
|
||||||
|
mimeType = m
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", mimeType)
|
w.Header().Set("Content-Type", mimeType)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue