mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Fix panic when fileSize is negative (#3089)
This commit is contained in:
@@ -48,8 +48,8 @@ func oshash(size int64, head []byte, tail []byte) (string, error) {
|
||||
|
||||
// FromFilePath calculates the hash reading from src.
|
||||
func FromReader(src io.ReadSeeker, fileSize int64) (string, error) {
|
||||
if fileSize == 0 {
|
||||
return "", nil
|
||||
if fileSize <= 0 {
|
||||
return "", fmt.Errorf("cannot calculate oshash for empty file (size %d)", fileSize)
|
||||
}
|
||||
|
||||
fileChunkSize := chunkSize
|
||||
|
||||
Reference in New Issue
Block a user