Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: validate custom domain link slugs
Marc Seitzfb651c40f404
diff --git a/components/links/link-sheet/domain-section.tsx b/components/links/link-sheet/domain-section.tsxindex c5223a5c..4fe76ba4 100644--- a/components/links/link-sheet/domain-section.tsx+++ b/components/links/link-sheet/domain-section.tsx@@ -149,7 +149,13 @@ export default function DomainSection({name="key"requiredvalue={data.slug || ""}- pattern="[\p{L}\p{N}\p{Pd}]+"+ pattern="^[a-zA-Z0-9-]+$"+ onKeyDown={(e) => {+ // Allow navigation keys, backspace, delete, etc.+ if (e.key.length === 1 && !/^[a-zA-Z0-9-]$/.test(e.key)) {+ e.preventDefault();+ }+ }}onInvalid={(e) => {const currentValue = e.currentTarget.value;const isBlocked = BLOCKED_PATHNAMES.includes(`/${currentValue}`);@@ -171,7 +177,7 @@ export default function DomainSection({)}placeholder="deck"onChange={(e) => {- const currentValue = e.target.value;+ const currentValue = e.target.value.replace(/[^a-zA-Z0-9-]/g, "");const isBlocked = BLOCKED_PATHNAMES.includes(`/${currentValue}`);if (isBlocked) {