mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-07 05:11:36 +00:00
🐛 Fix - Gosec issue
[/github/workspace/helpers.go:91-93] - G307 (CWE-703): Deferring unsafe method "Close" on type "*os.File" (Confidence: HIGH, Severity: MEDIUM)
This commit is contained in:
parent
92a811c93e
commit
9b47b767b7
@ -10,6 +10,7 @@ import (
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -89,7 +90,9 @@ func readContent(rf io.ReaderFrom, name string) (n int64, err error) {
|
||||
return 0, err
|
||||
}
|
||||
defer func() {
|
||||
err = f.Close()
|
||||
if err = f.Close(); err != nil {
|
||||
log.Printf("Error closing file: %s\n", err)
|
||||
}
|
||||
}()
|
||||
return rf.ReadFrom(f)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user