path unescape url when resolving remote reference

This commit is contained in:
zak905
2023-07-18 12:11:59 +02:00
committed by quobix
parent 3a238df141
commit 29a44e405a

View File

@@ -189,6 +189,11 @@ func (index *SpecIndex) lookupRemoteReference(ref string) (*yaml.Node, *yaml.Nod
} else {
query = "$"
}
query, err := url.PathUnescape(query)
if err != nil {
return nil, nil, err
}
// remove any URL encoding
query = strings.Replace(query, "~1", "./", 1)
@@ -284,6 +289,11 @@ func (index *SpecIndex) lookupFileReference(ref string) (*yaml.Node, *yaml.Node,
query = "$"
}
query, err := url.PathUnescape(query)
if err != nil {
return nil, nil, err
}
// remove any URL encoding
query = strings.Replace(query, "~1", "./", 1)
query = strings.ReplaceAll(query, "~1", "/")