Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonicalize and dedup URLs in to_rb #61

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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