Assert 64 bit file sizes even on 32 bit systems
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2023-03-16 14:42:48 -07:00
parent b02d9f7fb9
commit 08c6cdd858
1 changed files with 5 additions and 2 deletions

View File

@ -10,7 +10,6 @@ import (
"fmt"
"io"
"math"
"math/bits"
"os"
path "path/filepath"
"regexp"
@ -65,7 +64,7 @@ func (f Functionality) OnEvent(ev event.Event, profile peer.CwtchPeer) {
// will be bound to the size advertised in manifest.
fileSizeLimitValue, fileSizeLimitExists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%v.limit", fileKey))
if fileSizeLimitExists {
fileSizeLimit, err := strconv.ParseUint(fileSizeLimitValue, 10, bits.UintSize)
fileSizeLimit, err := strconv.ParseUint(fileSizeLimitValue, 10, 64)
if err == nil {
if manifest.FileSizeInBytes >= fileSizeLimit {
log.Debugf("could not download file, size %v greater than limit %v", manifest.FileSizeInBytes, fileSizeLimitValue)
@ -91,7 +90,11 @@ func (f Functionality) OnEvent(ev event.Event, profile peer.CwtchPeer) {
}))
}
}
} else {
log.Errorf("error saving manifest: file size limit is incorrect: %v", err)
}
} else {
log.Errorf("error saving manifest: could not find file size limit info")
}
} else {
log.Errorf("error saving manifest: %v", err)