From 3cf29a777de0ac951166c4db7f97e67ffa8b9e9e Mon Sep 17 00:00:00 2001 From: yoshiera Date: Mon, 21 Sep 2020 16:08:00 +0800 Subject: [PATCH] Fix nil check in rejectBySize --- changelog/unreleased/issue-2942 | 7 +++++++ cmd/restic/exclude.go | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 changelog/unreleased/issue-2942 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