Skip to content

fix(editor): allow tel: and sms: links in URL property control (#689) - #691

Merged
DavidBabinec merged 2 commits into
CoreBunch:mainfrom
ghazy2001:fix/url-field-allow-tel-and-sms
Nov 16, 2026
Merged

DavidBabinec merged 2 commits into
CoreBunch:mainfrom
ghazy2001:fix/url-field-allow-tel-and-sms

Conversation

@ghazy2001

Copy link
Copy Markdown
Contributor

Summary

The URL field in the Properties panel (UrlControl.tsx) previously rejected tel: and sms: hrefs with "Invalid URL", preventing users from configuring click-to-call or SMS links in Link and Button modules through the visual editor.

This occurred because isValidUrl() in src/core/utils/urlValidation.ts only permitted https:, http:, and mailto:, despite the publisher and sanitization engine (SAFE_URL_SCHEMES in src/core/html-sanitize/index.ts) already treating tel: and sms: as safe protocols. This created a discrepancy where tel:/sms: links imported via HTML were published correctly, but could not be typed or edited directly in the editor.

What Changed

  • src/core/utils/urlValidation.ts:
    • Expanded isValidUrl() to accept tel: and sms: schemes alongside https:, http:, and mailto:.
    • Updated JSDoc documentation and comments to reflect the updated scheme allowlist.
  • src/__tests__/utils/urlValidation.test.ts:
    • Added test cases under isValidUrl > allowed protocols for tel: (both international and dashed numbers) and sms: (including optional query parameters like ?body=...).
    • Added boundary tests verifying tel: and sms: are permitted by isValidUrl but rejected by isValidImageUrl.

Verification

  • bun test src/__tests__/utils/urlValidation.test.ts passed (39 tests passing, 0 failing).
  • bunx tsc --noEmit passed with 0 errors.
  • bunx eslint src/core/utils/urlValidation.ts src/__tests__/utils/urlValidation.test.ts passed with 0 errors.

Fixes #689.

@ghazy2001
ghazy2001 marked this pull request as ready for review November 14, 2026 13:56
The link field and the publisher kept separate scheme lists, which is how
tel: and sms: drifted apart in CoreBunch#689. isValidUrl now delegates the scheme
decision to isSafeUrl and still requires an absolute, parseable URL. A
parity test pins the two together.
@DavidBabinec
DavidBabinec merged commit 70efc05 into CoreBunch:main Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: URL field rejects tel: and sms: links that the publisher allows

2 participants