Ensure "existingfile" doesn't choke on "-".

This commit is contained in:
Alec Thomas
2020-04-27 09:10:44 +10:00
parent 407c8229a6
commit 51a1ea979a
+9 -7
View File
@@ -555,13 +555,15 @@ func existingFileMapper(r *Registry) MapperFunc {
if err != nil { if err != nil {
return err return err
} }
path = ExpandPath(path) if path != "-" {
stat, err := os.Stat(path) path = ExpandPath(path)
if err != nil { stat, err := os.Stat(path)
return err if err != nil {
} return err
if stat.IsDir() { }
return errors.Errorf("%q exists but is a directory", path) if stat.IsDir() {
return errors.Errorf("%q exists but is a directory", path)
}
} }
target.SetString(path) target.SetString(path)
return nil return nil