We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43707a6 commit a019489Copy full SHA for a019489
lib/file.go
@@ -223,14 +223,14 @@ func (i *File) GetFileType(checkContent bool) error {
223
224
// Only the first 512 bytes are used to sniff the content type.
225
buffer := make([]byte, 512)
226
- _, err = file.Read(buffer)
+ n, err := file.Read(buffer)
227
if err != nil && err != io.EOF {
228
return err
229
}
230
231
// Tries to get the file mimetype using its first
232
// 512 bytes.
233
- mimetype = http.DetectContentType(buffer)
+ mimetype = http.DetectContentType(buffer[:n])
234
235
236
if strings.HasPrefix(mimetype, "video") {
0 commit comments