From 9e9a90f8ef30ec0f0f3e03e2f69fb4703c7e7831 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Mon, 10 Jan 2022 17:45:44 +0900 Subject: [PATCH] Fix panic on normalizing path containing .. (#2042) Fixes #2039 --- pkg/state/storage.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/state/storage.go b/pkg/state/storage.go index 4d73f899..52700ad8 100644 --- a/pkg/state/storage.go +++ b/pkg/state/storage.go @@ -2,10 +2,11 @@ package state import ( "fmt" - "go.uber.org/zap" "net/url" "path/filepath" "sort" + + "go.uber.org/zap" ) type Storage struct { @@ -86,7 +87,7 @@ func (st *Storage) ExpandPaths(globPattern string) ([]string, error) { // normalizes relative path to absolute one func (st *Storage) normalizePath(path string) string { u, _ := url.Parse(path) - if u.Scheme != "" || filepath.IsAbs(path) { + if u != nil && (u.Scheme != "" || filepath.IsAbs(path)) { return path } else { return st.JoinBase(path)