Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix link target validation in
ExternalLinkBlock
(#2102)
## Problem: The validation in the ExternalLinkBlock was broken. The `isValid` check uses `isLinkTarget` for validation: https://github.com/vivid-planet/comet/blob/9867242fa6bad4849de58ccce1c28b816cc109a3/packages/admin/cms-admin/src/blocks/ExternalLinkBlock.tsx#L42-L44 The `targetUrl` field uses `validateUrl`: https://github.com/vivid-planet/comet/blob/9867242fa6bad4849de58ccce1c28b816cc109a3/packages/admin/cms-admin/src/blocks/ExternalLinkBlock.tsx#L66-L73 The problem was that `validateUrl` internally used `isUrl` from class validator. `isUrl` is less strict than `isLinkTarget`. This resulted in no validation error in the UI but an error when trying to save the block: https://github.com/vivid-planet/comet/assets/13380047/a6c91ce1-94a5-4aac-a755-ef497a506504 ## Solution: I added `validateLinkTarget` using the stricter `isLinkTarget` check.
- Loading branch information