Skip to content

Commit

Permalink
Bug fix windows parser empty-string guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Wireklint authored and EdSchouten committed Jul 8, 2024
1 parent 2dca465 commit 943b8a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/filesystem/path/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func TestBuilder(t *testing.T) {
} {
t.Run(from, func(t *testing.T) {
builder1, scopeWalker1 := path.EmptyBuilder.Join(path.VoidScopeWalker)
require.NoError(t, path.Resolve(path.NewUNIXParser(from), scopeWalker1))
require.NoError(t, path.Resolve(path.NewWindowsParser(from), scopeWalker1))
require.Equal(t, to, mustGetWindowsString(builder1))

builder2, scopeWalker2 := path.EmptyBuilder.Join(path.VoidScopeWalker)
Expand Down
2 changes: 1 addition & 1 deletion pkg/filesystem/path/windows_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (p windowsParser) ParseScope(scopeWalker ScopeWalker) (next ComponentWalker
}
}

if len(p.path) >= 1 && p.path[0] == '\\' || p.path[0] == '/' {
if len(p.path) >= 1 && (p.path[0] == '\\' || p.path[0] == '/') {
next, err = scopeWalker.OnAbsolute()
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 943b8a0

Please sign in to comment.