[lectures] Fix content type detection.
This commit is contained in:
parent
9944c84b9d
commit
49be410e05
1 changed files with 1 additions and 2 deletions
|
@ -39,8 +39,7 @@ func copyHandler(w http.ResponseWriter, r *http.Request) {
|
|||
defer func() { _ = f.Close() }()
|
||||
|
||||
// Infer the Content-Type of the file.
|
||||
filePrefix := make([]byte, 1024)
|
||||
_, _ = io.ReadAtLeast(f, filePrefix, 512)
|
||||
filePrefix, _ := io.ReadAll(io.LimitReader(f, 512))
|
||||
contentType := http.DetectContentType(filePrefix)
|
||||
|
||||
// Get the file size.
|
||||
|
|
Loading…
Reference in a new issue