Skip to content

Commit

Permalink
Fix panic on normalizing path containing .. (#2042)
Browse files Browse the repository at this point in the history
Fixes #2039
  • Loading branch information
mumoshu authored Jan 10, 2022
1 parent c069fbf commit 9e9a90f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/state/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package state

import (
"fmt"
"go.uber.org/zap"
"net/url"
"path/filepath"
"sort"

"go.uber.org/zap"
)

type Storage struct {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9e9a90f

Please sign in to comment.