From cfa8a02d828f9ccf5d125bb2f94e5b0f1ec19dd6 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Wed, 17 Sep 2025 14:29:35 +0200 Subject: [PATCH 1/2] chore: output more logs --- src/storage/version/put.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/storage/version/put.js b/src/storage/version/put.js index c88ab877..d24b2777 100644 --- a/src/storage/version/put.js +++ b/src/storage/version/put.js @@ -119,7 +119,10 @@ export async function putObjectWithVersion(env, daCtx, update, body, guid) { const Preparsingstore = storeBody ? Timestamp : pps; let Label = storeBody ? 'Collab Parse' : update.label; - if (daCtx.method === 'PUT' && current.contentLength > EMPTY_DOC_SIZE && (!update.body || update.body.size <= EMPTY_DOC_SIZE)) { + if (daCtx.method === 'PUT' + && daCtx.ext === 'html' + && current.contentLength > EMPTY_DOC_SIZE + && (!update.body || update.body.size <= EMPTY_DOC_SIZE)) { // we are about to empty the document body // this should never happen but in some cases it does // we want then to store a version of the full document as a restore point @@ -127,6 +130,17 @@ export async function putObjectWithVersion(env, daCtx, update, body, guid) { console.warn('Empty body, creating a restore point'); storeBody = true; Label = 'Restore Point'; + + // TODO remove this after testing + try { + // eslint-disable-next-line + console.log('Current version of the document', current.contentLength, await current.body.transformToString('utf-8')); + // eslint-disable-next-line + console.log('New version of the document', update.body?.size, await update.body?.text()); + } catch (e) { + // eslint-disable-next-line + console.error('Error prodiving output', e); + } } const versionResp = await putVersion(config, { From 0dcb67fec16dd77910f35e87c8558586deace6fd Mon Sep 17 00:00:00 2001 From: kptdobe Date: Wed, 17 Sep 2025 14:44:33 +0200 Subject: [PATCH 2/2] chore: log sizes --- src/storage/version/put.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/storage/version/put.js b/src/storage/version/put.js index d24b2777..f71cf943 100644 --- a/src/storage/version/put.js +++ b/src/storage/version/put.js @@ -124,23 +124,12 @@ export async function putObjectWithVersion(env, daCtx, update, body, guid) { && current.contentLength > EMPTY_DOC_SIZE && (!update.body || update.body.size <= EMPTY_DOC_SIZE)) { // we are about to empty the document body - // this should never happen but in some cases it does - // we want then to store a version of the full document as a restore point + // this should almost never happen but it does in some unexpectedcases + // we want then to store a version of the full document as a Restore Point // eslint-disable-next-line no-console - console.warn('Empty body, creating a restore point'); + console.warn(`Empty body, creating a restore point (${current.contentLength} / ${update.body?.size})`); storeBody = true; Label = 'Restore Point'; - - // TODO remove this after testing - try { - // eslint-disable-next-line - console.log('Current version of the document', current.contentLength, await current.body.transformToString('utf-8')); - // eslint-disable-next-line - console.log('New version of the document', update.body?.size, await update.body?.text()); - } catch (e) { - // eslint-disable-next-line - console.error('Error prodiving output', e); - } } const versionResp = await putVersion(config, {