json-gold icon indicating copy to clipboard operation
json-gold copied to clipboard

This looks like a bug

Open jaydonnell opened this issue 5 years ago • 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
}

jaydonnell avatar Nov 01 '20 01:11 jaydonnell

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

kazarena avatar Nov 01 '20 11:11 kazarena