mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 20:47:49 +00:00
path unescape url when resolving remote reference
This commit is contained in:
@@ -190,6 +190,11 @@ func (index *SpecIndex) lookupRemoteReference(ref string) (*yaml.Node, *yaml.Nod
|
|||||||
query = "$"
|
query = "$"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query, err := url.PathUnescape(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// remove any URL encoding
|
// remove any URL encoding
|
||||||
query = strings.Replace(query, "~1", "./", 1)
|
query = strings.Replace(query, "~1", "./", 1)
|
||||||
query = strings.ReplaceAll(query, "~1", "/")
|
query = strings.ReplaceAll(query, "~1", "/")
|
||||||
@@ -284,6 +289,11 @@ func (index *SpecIndex) lookupFileReference(ref string) (*yaml.Node, *yaml.Node,
|
|||||||
query = "$"
|
query = "$"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query, err := url.PathUnescape(query)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// remove any URL encoding
|
// remove any URL encoding
|
||||||
query = strings.Replace(query, "~1", "./", 1)
|
query = strings.Replace(query, "~1", "./", 1)
|
||||||
query = strings.ReplaceAll(query, "~1", "/")
|
query = strings.ReplaceAll(query, "~1", "/")
|
||||||
|
|||||||
Reference in New Issue
Block a user