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
+2
View File
@@ -555,6 +555,7 @@ func existingFileMapper(r *Registry) MapperFunc {
if err != nil { if err != nil {
return err return err
} }
if path != "-" {
path = ExpandPath(path) path = ExpandPath(path)
stat, err := os.Stat(path) stat, err := os.Stat(path)
if err != nil { if err != nil {
@@ -563,6 +564,7 @@ func existingFileMapper(r *Registry) MapperFunc {
if stat.IsDir() { if stat.IsDir() {
return errors.Errorf("%q exists but is a directory", path) return errors.Errorf("%q exists but is a directory", path)
} }
}
target.SetString(path) target.SetString(path)
return nil return nil
} }