🐛 Fix hash bug

This commit is contained in:
2024-11-03 11:40:21 +08:00
parent 3f9df23491
commit 4223eb6ecd
2 changed files with 5 additions and 16 deletions

View File

@ -277,7 +277,7 @@ func HashAttachment(file models.Attachment) (hash string, err error) {
hasher := sha256.New()
if chunkSize*3 <= fileInfo.Size() {
if chunkSize*3 > fileInfo.Size() {
// If the total size is smaller than three chunks, then hash the whole file
buf := make([]byte, fileInfo.Size())
if _, err := inFile.Read(buf); err != nil && err != io.EOF {