piprate/json-gold

This looks like a bug

jaydonnell opened this issue · 1 comments

If I'm reading this code correctly, you are checking if something is an IRI with strings.Contains(iri, ":"). This will match strings which have colons but are not IRIs.

func (jldp *JsonLdProcessor) expand(input interface{}, opts *JsonLdOptions) ([]interface{}, error) {

	// 1)
	// TODO: look into promises

	var remoteContext string

	// 2)
	if iri, isString := input.(string); isString && strings.Contains(iri, ":") {

If that is what this code intends to do, maybe use this

import "net/url"

...

u, err := url.ParseRequestURI("http://google.com/")
if err != nil {
   panic(err) // not a valid URI
}

Thanks, that's a fair point. Will address.