diff options
author | Reto Kaiser <reto@retoonline.com> | 2019-01-10 12:55:35 +0300 |
---|---|---|
committer | Reto Kaiser <reto@retoonline.com> | 2019-01-10 12:55:35 +0300 |
commit | bc30f40b50d2aff92c9247137cfaeb245e87dff8 (patch) | |
tree | 5cff327cfc6963b6a014bffd364143219239f8e8 | |
parent | 5ad7c5480133c944839a939b1781bfe178c70113 (diff) |
Adding `defer file.Close()` in D.detectContentType()
-rw-r--r-- | internal/domain/domain.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index 80baf259..de096d77 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -239,6 +239,7 @@ func (d *D) detectContentType(path string) (string, error) { if err != nil { return "", err } + defer file.Close() // Using `io.ReadFull()` because `file.Read()` may be chunked. // Ignoring errors because we don't care if the 512 bytes cannot be read. n, _ := io.ReadFull(file, buf[:]) |