From c5575c7ed921400a3ebed1aea8306a6f572c705e Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 11 Feb 2018 20:56:11 +0100 Subject: [PATCH 1/2] Strip spaces from items read via --files-from In #1590, it was mentioned that while lines read from exclude files via `--exclude-file` have leading and trailing spaces stripped, this is not the case for lines read via `--files-from`. This commit fixes that, spaces are always stripped. --- cmd/restic/cmd_backup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 67378e115..4e78a1534 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -304,7 +304,7 @@ func readLinesFromFile(filename string) ([]string, error) { scanner := bufio.NewScanner(r) for scanner.Scan() { - line := scanner.Text() + line := strings.TrimSpace(scanner.Text()) // ignore empty lines if line == "" { continue From cff3f3dc0de4de7e1fa93525ef38edc5fd8b3f01 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 11 Feb 2018 21:00:38 +0100 Subject: [PATCH 2/2] Add entry to CHANGELOG --- changelog/0.8.2/issue-1590 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/0.8.2/issue-1590 diff --git a/changelog/0.8.2/issue-1590 b/changelog/0.8.2/issue-1590 new file mode 100644 index 000000000..47000b435 --- /dev/null +++ b/changelog/0.8.2/issue-1590 @@ -0,0 +1,7 @@ +Bugfix: Strip spaces for lines read via --files-from + +Leading and trailing spaces in lines read via `--files-from` are now stripped, +so it behaves the same as with lines read via `--exclude-file`. + +https://github.com/restic/restic/issues/1590 +https://github.com/restic/restic/pull/1613