Skip to content

Commit 3f8c98f

Browse files
committed
fix: deep copy imported contexts
1 parent e3519d2 commit 3f8c98f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ContextParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ must be one of ${Util.CONTAINERS.join(', ')}`, ERROR_CODES.INVALID_CONTAINER_MAP
863863
* @param importContextIri The full URI of an @import value.
864864
*/
865865
public async loadImportContext(importContextIri: string): Promise<IJsonLdContextNormalizedRaw> {
866-
// Load the context
867-
const importContext = await this.load(importContextIri);
866+
// Load the context - and do a deep clone since we are about to mutate it
867+
const importContext = JSON.parse(JSON.stringify(await this.load(importContextIri)));
868868

869869
// Require the context to be a non-array object
870870
if (typeof importContext !== 'object' || Array.isArray(importContext)) {

0 commit comments

Comments
 (0)