Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: obfuscate data-id

Marc Seitza8b98d811627
diff --git a/components/view/viewer/notion-page.tsx b/components/view/viewer/notion-page.tsx
index 4beb997b..127b61c3 100644
--- a/components/view/viewer/notion-page.tsx
+++ b/components/view/viewer/notion-page.tsx
@@ -81,6 +81,16 @@ const obfuscateNotionIds = (container: HTMLElement) => {
uuidPattern.lastIndex = 0;
});
+ // Obfuscate data-id attributes
+ const elementsWithDataId = container.querySelectorAll("[data-id]");
+ elementsWithDataId.forEach((el) => {
+ const dataId = el.getAttribute("data-id");
+ if (dataId && uuidPattern.test(dataId)) {
+ el.setAttribute("data-id", getObfuscatedId(dataId));
+ }
+ uuidPattern.lastIndex = 0;
+ });
+
// Obfuscate class names that contain Notion IDs
const allElements = container.querySelectorAll("*");
allElements.forEach((el) => {
@@ -122,7 +132,7 @@ export const NotionPage = ({
const [recordMapState, setRecordMapState] =
useState<ExtendedRecordMap>(recordMap);
-
+
const notionContainerRef = useRef<HTMLDivElement>(null);
// Create a cache object to store fetched recordMaps