mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
path unescape url when resolving remote reference
This commit is contained in:
@@ -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", "/")
|
||||
|
||||
Reference in New Issue
Block a user