This commit is contained in:
@@ -5,16 +5,16 @@ import (
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func FileMD5(fp string) (string, error) {
|
||||
f, err := os.OpenFile(fp, os.O_RDONLY, 0)
|
||||
f, err := os.OpenFile(filepath.Clean(fp), os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
|
||||
hasher := md5.New()
|
||||
if _, err := io.Copy(hasher, f); err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user