Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class MessageBus extends EventEmitter {
try {
await this._addMatch(nameOwnerMatchRule);
} catch (error) {
this.emit("error", error);
this.emit('error', error);
return;
}

Expand Down
21 changes: 20 additions & 1 deletion lib/marshall-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,27 @@ function jsToMarshalFmt (signature, value) {
if (value.constructor !== Object) {
throw new Error(`expecting an object for signature '${signatureStr}' (got ${typeof value})`);
}
for (const k of Object.keys(value)) {
for (let k of Object.keys(value)) {
const v = value[k];
// js always converts keys of objects to string
// convert them back if the signature requires it
if (signature.child[0].child[0]) {
const keyType = signature.child[0].child[0].type;
if (['y', 'n', 'q', 'i', 'x', 't'].includes(keyType)) {
// key should be integer
try {
k = parseInt(k);
} catch (e) {
throw new Error(`error parsing dict key for signature '${signatureStr}' (key: ${key})`);
}
} else if (['b'].includes(keyType)) {
// key should be boolean
if (!(k === 'true' || k === 'false')) {
throw new Error(`error parsing dict key for signature '${signatureStr}' (key: ${key})`);
}
k = k === 'true';
}
}
if (v.constructor === Variant) {
result.push([k, jsToMarshalFmt(v.signature, v.value)]);
} else {
Expand Down
Loading