Skip to content

Conversation

jhawthorn
Copy link

@jhawthorn jhawthorn commented Feb 19, 2024

JSON::LD::Context#parse will only look in the PRELOADED hash with a fully canonicalized URL including replacing https with http. This means that any preloads or aliases under non-canonicalized names won't work and can't be used and will just waste memory.

This commit fully canonicalizes both the base and alias URLs (including changing https to http) and removes any duplicates.

I considered adding error checking or canonicalization in add_preloaded and alias_preloaded as well, but I'll propose that separately as compatibility is tricky.

See also ruby-rdf/json-ld-preloaded#7 where this is applied, and it ends up removing all aliases (they were unnecessary) and fixing a preload which previously was not working at all (attempting to use it would make the HTTP request).

JSON::LD::Context#parse will only look in the PRELOADED hash with a
fully canonicalized URL including replacing https with http. This means
that any preloads or aliases under non-canonicalized names can't be used
and will just waste memory.

This commit fully canonicalizes both the base and alias URLs (including
changing https to http) and removes any duplicates.
@CLAassistant
Copy link

CLAassistant commented Feb 19, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants