Skip to content

Commit 5d52d37

Browse files
committed
Dup context when parsing to prevent modifying the original.
1 parent 24944f8 commit 5d52d37

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/json/ld/context.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def parse(local_context, remote_contexts = [])
295295
debug("parse") {"=> provided_context: #{context.inspect}"}
296296
when Hash
297297
# If context has a @vocab member: if its value is not a valid absolute IRI or null trigger an INVALID_VOCAB_MAPPING error; otherwise set the active context's vocabulary mapping to its value and remove the @vocab member from context.
298+
context = context.dup # keep from modifying a hash passed as a param
298299
{
299300
'@base' => :base=,
300301
'@language' => :default_language=,

0 commit comments

Comments
 (0)