From 3b20c094c539eb403d232c48ae0d9c6210db5a61 Mon Sep 17 00:00:00 2001 From: Carl Johnson Date: Wed, 30 Jan 2019 15:35:45 +0000 Subject: [PATCH] Windows Compatability (#15) path module doesn't support windows paths path.Dir('path\to\doc.md') returns "" instead of "path\to" this causes a valid link to 'img.png' in this document to be reported as invalid, since later on we os.stat("img.png") when it should be os.stat("path\to\img.png") --- url_checker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/url_checker.go b/url_checker.go index 3d5527d..f3895a0 100644 --- a/url_checker.go +++ b/url_checker.go @@ -5,6 +5,7 @@ import ( "net/url" "os" "path" + "path/filepath" "regexp" "sync" "time" @@ -78,7 +79,7 @@ func (c urlChecker) resolveURL(u string, f string) (string, bool, error) { } if !path.IsAbs(uu.Path) { - return path.Join(path.Dir(f), uu.Path), true, nil + return path.Join(filepath.Dir(f), uu.Path), true, nil } if c.documentRoot == "" {