Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReto Kaiser <reto@retoonline.com>2019-01-10 12:55:35 +0300
committerReto Kaiser <reto@retoonline.com>2019-01-10 12:55:35 +0300
commitbc30f40b50d2aff92c9247137cfaeb245e87dff8 (patch)
tree5cff327cfc6963b6a014bffd364143219239f8e8
parent5ad7c5480133c944839a939b1781bfe178c70113 (diff)
Adding `defer file.Close()` in D.detectContentType()
-rw-r--r--internal/domain/domain.go1
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[:])