From f5c6f66c8f3f260e24441853e879c38b87e81375 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 27 Jun 2020 17:59:28 -0400 Subject: [PATCH] Fix path escaping on Windows Windows does not allow ':' in a path, but for some reason previous versions still worked, except the file for storing buffer info (which had a ':' in the name) was not viewable except by opening it with micro. Ref #1736 --- internal/util/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/util/util.go b/internal/util/util.go index 8b867ca0..317cd65d 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -336,6 +336,10 @@ func GetModTime(path string) (time.Time, error) { // EscapePath replaces every path separator in a given path with a % func EscapePath(path string) string { path = filepath.ToSlash(path) + if runtime.GOOS == "windows" { + // ':' is not valid in a path name on Windows but is ok on Unix + path = strings.Replace(path, ":", "%", -1) + } return strings.Replace(path, "/", "%", -1) } -- 2.44.0