From 6518192478b05c3d26024f5e9014ec5d47a2c651 Mon Sep 17 00:00:00 2001 From: Palanikannan M Date: Fri, 3 Oct 2025 09:05:59 +0530 Subject: [PATCH 1/2] fix: throw error in case of failure --- apps/live/src/extensions/database.ts | 16 +++++++++++++--- apps/live/src/services/page/core.service.ts | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/live/src/extensions/database.ts b/apps/live/src/extensions/database.ts index dc797881087..d23fbd8fcbe 100644 --- a/apps/live/src/extensions/database.ts +++ b/apps/live/src/extensions/database.ts @@ -11,6 +11,16 @@ import { getPageService } from "@/services/page/handler"; // type import type { FetchPayloadWithContext, StorePayloadWithContext } from "@/types"; +const normalizeToError = (error: unknown, fallbackMessage: string) => { + if (error instanceof Error) { + return error; + } + + const message = typeof error === "string" && error.trim().length > 0 ? error : fallbackMessage; + + return new Error(message); +}; + const fetchDocument = async ({ context, documentName: pageId }: FetchPayloadWithContext) => { try { const service = getPageService(context.documentType, context); @@ -29,7 +39,7 @@ const fetchDocument = async ({ context, documentName: pageId }: FetchPayloadWith return binaryData; } catch (error) { logger.error("Error in fetching document", error); - throw error; + throw normalizeToError(error, `Failed to fetch document: ${pageId}`); } }; @@ -45,10 +55,10 @@ const storeDocument = async ({ context, state: pageBinaryData, documentName: pag description_html: contentHTML, description: contentJSON, }; - return service.updateDescriptionBinary(pageId, payload); + await service.updateDescriptionBinary(pageId, payload); } catch (error) { logger.error("Error in updating document:", error); - throw error; + throw normalizeToError(error, `Failed to update document: ${pageId}`); } }; diff --git a/apps/live/src/services/page/core.service.ts b/apps/live/src/services/page/core.service.ts index ee0588b5588..922c1e5d507 100644 --- a/apps/live/src/services/page/core.service.ts +++ b/apps/live/src/services/page/core.service.ts @@ -21,7 +21,7 @@ export abstract class PageCoreService extends APIService { }) .then((response) => response?.data) .catch((error) => { - throw error?.response?.data; + throw error; }); } @@ -35,7 +35,7 @@ export abstract class PageCoreService extends APIService { }) .then((response) => response?.data) .catch((error) => { - throw error?.response?.data; + throw error; }); } From 26f265aef9141a7c7c860ca6f2242381029a67e7 Mon Sep 17 00:00:00 2001 From: Dheeraj Kumar Ketireddy Date: Fri, 3 Oct 2025 12:39:11 +0530 Subject: [PATCH 2/2] Added xmlns to allowed arrtibutes --- apps/api/plane/utils/content_validator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/api/plane/utils/content_validator.py b/apps/api/plane/utils/content_validator.py index c352205aafb..5163fad7dd3 100644 --- a/apps/api/plane/utils/content_validator.py +++ b/apps/api/plane/utils/content_validator.py @@ -84,6 +84,7 @@ def validate_binary_data(data): "style", "start", "type", + "xmlns", # common editor data-* attributes seen in stored HTML # (wildcards like data-* are NOT supported by nh3; we add known keys # here and dynamically include all data-* seen in the input below)