From 51a1ea979a88383a62d176161b8503a8045cb46c Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 27 Apr 2020 09:10:44 +1000 Subject: [PATCH] Ensure "existingfile" doesn't choke on "-". --- mapper.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mapper.go b/mapper.go index 0291184..a605dea 100644 --- a/mapper.go +++ b/mapper.go @@ -555,13 +555,15 @@ func existingFileMapper(r *Registry) MapperFunc { if err != nil { return err } - path = ExpandPath(path) - stat, err := os.Stat(path) - if err != nil { - return err - } - if stat.IsDir() { - return errors.Errorf("%q exists but is a directory", path) + if path != "-" { + path = ExpandPath(path) + stat, err := os.Stat(path) + if err != nil { + return err + } + if stat.IsDir() { + return errors.Errorf("%q exists but is a directory", path) + } } target.SetString(path) return nil