diff --git a/changelog/unreleased/issue-2942 b/changelog/unreleased/issue-2942 new file mode 100644 index 000000000..c79c1f226 --- /dev/null +++ b/changelog/unreleased/issue-2942 @@ -0,0 +1,7 @@ +Bugfix: Make --exclude-larger-than handle disappearing files + +There was a small bug in the backup command's --exclude-larger-than +option where files that disappeared between scanning and actually +backing them up to the repository caused a panic. This is now fixed. + +https://github.com/restic/restic/issues/2942 diff --git a/cmd/restic/exclude.go b/cmd/restic/exclude.go index cb96d7b5c..0b800d32e 100644 --- a/cmd/restic/exclude.go +++ b/cmd/restic/exclude.go @@ -301,6 +301,10 @@ func rejectBySize(maxSizeStr string) (RejectFunc, error) { } return func(item string, fi os.FileInfo) bool { + if fi == nil { + return false + } + // directory will be ignored if fi.IsDir() { return false