From 0254521f06cfc620e4479d6393e002008bdafbd0 Mon Sep 17 00:00:00 2001 From: Wolfgang Ginolas Date: Wed, 25 Feb 2026 14:31:45 +0100 Subject: [PATCH 1/2] Add logging to the Office document parser It can be enabled with localStorage.CryptPad_dev = "1" (in the correct iframe) --- sdkjs/common/HistoryCommon.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sdkjs/common/HistoryCommon.js b/sdkjs/common/HistoryCommon.js index b2a7ea5e25..c0f1b01f47 100644 --- a/sdkjs/common/HistoryCommon.js +++ b/sdkjs/common/HistoryCommon.js @@ -4880,6 +4880,29 @@ this.Class = Class; this.Reverted = false; + + // CryptPad: Add parser debug logging + if (localStorage.CryptPad_dev != "1") { + return; + } + if (this.Load) { + const origLoad = this.Load; + this.Load = function () { + const properties = {}; + const keys = Object.keys(this); + for (let i = 0; i < keys.length; i++) { + const p = keys[i]; + const firstChar = p.charAt(0); + if (firstChar.toUpperCase() === firstChar + && p !== "Class" + && typeof this[p] !== "function") { + properties[p] = ""+this[p]; + } + } + console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties); + return Reflect.apply(origLoad, this, arguments); + }; + } } CChangesBase.prototype.Type = window['AscDFH'].historyitem_Unknown_Unknown; CChangesBase.prototype.GetType = function() From 5d65c292370aeaa032bbea51a6d07f7a8556d08e Mon Sep 17 00:00:00 2001 From: Wolfgang Ginolas Date: Mon, 2 Mar 2026 14:03:38 +0100 Subject: [PATCH 2/2] Improve patch logging --- sdkjs/common/HistoryCommon.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdkjs/common/HistoryCommon.js b/sdkjs/common/HistoryCommon.js index c0f1b01f47..b2d584be89 100644 --- a/sdkjs/common/HistoryCommon.js +++ b/sdkjs/common/HistoryCommon.js @@ -4896,7 +4896,13 @@ if (firstChar.toUpperCase() === firstChar && p !== "Class" && typeof this[p] !== "function") { - properties[p] = ""+this[p]; + let pStr; + try { + pStr = JSON.stringify(this[p]); + } catch(e) { + pStr = ""+this[p]; + } + properties[p] = pStr; } } console.log("Load", this.constructor.name, Class.constructor.name, Class.Id, properties);