summaryrefslogtreecommitdiff
path: root/vendor/github.com/xeipuuv/gojsonreference/reference.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-01-08 14:52:57 +0100
committerValentin Rothberg <rothberg@redhat.com>2019-01-11 13:38:11 +0100
commitbd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87 (patch)
tree5f06e4e289f16d9164d692590a3fe6541b5384cf /vendor/github.com/xeipuuv/gojsonreference/reference.go
parent545f24421247c9f6251a634764db3f8f8070a812 (diff)
downloadpodman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.gz
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.bz2
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.zip
vendor: update everything
* If possible, update each dependency to the latest available version. * Use releases over commit IDs and avoid vendoring branches. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/xeipuuv/gojsonreference/reference.go')
-rw-r--r--vendor/github.com/xeipuuv/gojsonreference/reference.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/vendor/github.com/xeipuuv/gojsonreference/reference.go b/vendor/github.com/xeipuuv/gojsonreference/reference.go
index d4d2eca0a..645729130 100644
--- a/vendor/github.com/xeipuuv/gojsonreference/reference.go
+++ b/vendor/github.com/xeipuuv/gojsonreference/reference.go
@@ -27,11 +27,12 @@ package gojsonreference
import (
"errors"
- "github.com/xeipuuv/gojsonpointer"
"net/url"
"path/filepath"
"runtime"
"strings"
+
+ "github.com/xeipuuv/gojsonpointer"
)
const (
@@ -124,16 +125,21 @@ func (r *JsonReference) parse(jsonReferenceString string) (err error) {
// Creates a new reference from a parent and a child
// If the child cannot inherit from the parent, an error is returned
func (r *JsonReference) Inherits(child JsonReference) (*JsonReference, error) {
- childUrl := child.GetUrl()
- parentUrl := r.GetUrl()
- if childUrl == nil {
+ if child.GetUrl() == nil {
return nil, errors.New("childUrl is nil!")
}
- if parentUrl == nil {
+
+ if r.GetUrl() == nil {
return nil, errors.New("parentUrl is nil!")
}
- ref, err := NewJsonReference(parentUrl.ResolveReference(childUrl).String())
+ // Get a copy of the parent url to make sure we do not modify the original.
+ // URL reference resolving fails if the fragment of the child is empty, but the parent's is not.
+ // The fragment of the child must be used, so the fragment of the parent is manually removed.
+ parentUrl := *r.GetUrl()
+ parentUrl.Fragment = ""
+
+ ref, err := NewJsonReference(parentUrl.ResolveReference(child.GetUrl()).String())
if err != nil {
return nil, err
}