|
|
|
@ -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)
|
|
|
|
|