diff --git a/public/Assets/Lib/Trasformapi.js b/public/Assets/Lib/Trasformapi.js index 8b4d5f1..f67edfa 100644 --- a/public/Assets/Lib/Trasformapi.js +++ b/public/Assets/Lib/Trasformapi.js @@ -31,15 +31,19 @@ Exp.Trasformapi = (transformerXml, initOptions={}) => { function _TransformForInput (transformerTree, initOptions, entityName, upstreamName, dataIn, transformOptions={}) { const globalSets = { ...initOptions.sets, ...transformOptions.sets }; - // due to a bug in defiant, we need to prefix something to any key starting with '@'... + // due to 2 bugs in defiant, we need to rename json keys // function JsonObjectKeysFix (obj) { // TODO avoid collisions? (even if they're unlikely with what we're doing) return (obj !== undefined && obj !== null ? Object.fromEntries(Object.entries(obj).map( ([key,value]) => { - const newKey = (key.startsWith('@') ? `_${key}` : key); + key = key.replaceAll(':', '_'); // avoid "XML Parsing Error: prefix not bound to a namespace" on Firefox + if (key.startsWith('@')) { + // prefix any key starting with '@' with a character + key = `_${key}` + }; return typeof value == "object" - ? [newKey, JsonObjectKeysFix(value)] - : [newKey, value] + ? [key, JsonObjectKeysFix(value)] + : [key, value] })) : obj); } function MakeApiEntityObject (entityName, upstreamName, dataIn) { diff --git a/public/MBViewer/js/MBViewer.js b/public/MBViewer/js/MBViewer.js index 5e07045..f7d80ac 100644 --- a/public/MBViewer/js/MBViewer.js +++ b/public/MBViewer/js/MBViewer.js @@ -309,6 +309,7 @@ async function MbViewerInit () { (XPath support for both XML sources, and JSON sources via defiant.js)
* Only slightly better RSS support
* Initial, experimental support for Mastodon profiles (broken) +
* Hotfixed a defiant parsing bug on Firefox

`, time: '2024-01-24T01:00' }, { content: `

Copyright notice: MBViewer uses code borrowed from t.me, specially modified to handle customized data visualizations in an MB-style.