Skip to content

Commit

Permalink
Fix custom context overrides.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Nov 30, 2023
1 parent af1093d commit debd99a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @digitalbazaar/cborld ChangeLog

## 6.0.2 - 2023-11-dd

### Fixed
- Ensure custom `appContextMap` is used first before registered table of
term codecs.

## 6.0.1 - 2023-11-29

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/codecs/ContextDecoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ContextDecoder extends CborldDecoder {
}

// handle compressed context
const url = ID_TO_STRING.get(value) || this.reverseAppContextMap.get(value);
const url = this.reverseAppContextMap.get(value) || ID_TO_STRING.get(value);
if(url === undefined) {
throw new CborldError(
'ERR_UNDEFINED_COMPRESSED_CONTEXT',
Expand Down
2 changes: 1 addition & 1 deletion lib/codecs/ContextEncoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class ContextEncoder extends CborldEncoder {

encode() {
const {context} = this;
const id = STRING_TO_ID.get(context) || this.appContextMap.get(context);
const id = this.appContextMap.get(context) || STRING_TO_ID.get(context);
if(id === undefined) {
return new Token(Type.string, context);
}
Expand Down

0 comments on commit debd99a

Please sign in to comment.