Replace int for Maximum/MinimumFileCount with uint, since there should never be negative values and default value overflows otherwise
This commit is contained in:
parent
0d252d0456
commit
f5eb1f56f4
|
@ -332,7 +332,7 @@ func scanPath(path string, fileChannel chan<- string, statChannel chan<- *scanSt
|
|||
errorChannel <- err
|
||||
}
|
||||
|
||||
if files > 0 && (files < MinimumFileCount) || (files > MaximumFileCount) {
|
||||
if files > 0 && (files < int(MinimumFileCount)) || (files > int(MaximumFileCount)) {
|
||||
// This count will not otherwise include the parent directory itself, so increment by one
|
||||
stats.directoriesSkipped = stats.directoriesSkipped + directories + 1
|
||||
stats.filesSkipped = stats.filesSkipped + files
|
||||
|
|
10
cmd/root.go
10
cmd/root.go
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
ReleaseVersion string = "0.88.0"
|
||||
ReleaseVersion string = "0.88.1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -27,8 +27,8 @@ var (
|
|||
Handlers bool
|
||||
Images bool
|
||||
Info bool
|
||||
MaximumFileCount int
|
||||
MinimumFileCount int
|
||||
MaximumFileCount uint
|
||||
MinimumFileCount uint
|
||||
PageLength uint32
|
||||
Port uint16
|
||||
Prefix string
|
||||
|
@ -77,8 +77,8 @@ func init() {
|
|||
rootCmd.Flags().BoolVar(&Handlers, "handlers", false, "display registered handlers (for debugging)")
|
||||
rootCmd.Flags().BoolVar(&Images, "images", false, "enable support for image files")
|
||||
rootCmd.Flags().BoolVarP(&Info, "info", "i", false, "expose informational endpoints")
|
||||
rootCmd.Flags().IntVar(&MaximumFileCount, "maximum-files", 1<<32-1, "skip directories with file counts above this value")
|
||||
rootCmd.Flags().IntVar(&MinimumFileCount, "minimum-files", 1, "skip directories with file counts below this value")
|
||||
rootCmd.Flags().UintVar(&MaximumFileCount, "maximum-files", 1<<32-1, "skip directories with file counts above this value")
|
||||
rootCmd.Flags().UintVar(&MinimumFileCount, "minimum-files", 1, "skip directories with file counts below this value")
|
||||
rootCmd.Flags().Uint32Var(&PageLength, "page-length", 0, "pagination length for info pages")
|
||||
rootCmd.Flags().Uint16VarP(&Port, "port", "p", 8080, "port to listen on")
|
||||
rootCmd.Flags().StringVar(&Prefix, "prefix", "/", "root path for http handlers (for reverse proxying)")
|
||||
|
|
Loading…
Reference in New Issue