fix: set default mimetype to empty string (close #1710)

pull/1831/head
Noah Hsu 2022-09-19 18:58:40 +08:00
parent d8dc8d8623
commit ca177cc3b9
1 changed files with 5 additions and 4 deletions

View File

@ -419,10 +419,11 @@ func findContentType(ctx context.Context, ls LockSystem, name string, fi model.O
//defer f.Close() //defer f.Close()
// This implementation is based on serveContent's code in the standard net/http package. // This implementation is based on serveContent's code in the standard net/http package.
ctype := mime.TypeByExtension(path.Ext(name)) ctype := mime.TypeByExtension(path.Ext(name))
if ctype != "" {
return ctype, nil return ctype, nil
} //if ctype != "" {
return "application/octet-stream", nil // return ctype, nil
//}
//return "application/octet-stream", nil
// Read a chunk to decide between utf-8 text and binary. // Read a chunk to decide between utf-8 text and binary.
//var buf [512]byte //var buf [512]byte
//n, err := io.ReadFull(f, buf[:]) //n, err := io.ReadFull(f, buf[:])