[PR #7052] [MERGED] fix(url): keep capitalized mailto: and tel: links as they are #6621

Closed
opened 2026-11-07 14:34:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7052
Author: @kevin9327
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @MHSanaei

Base: main ← Head: fix/url-scheme-case


📝 Commits (1)

  • f1bc46b fix(url): keep capitalized mailto: and tel: links as they are

📊 Changes

2 files changed (+7 additions, -2 deletions)

View changed files

📝 internal/util/common/url.go (+5 -2)
📝 internal/util/common/url_test.go (+2 -0)

📄 Description

Summary

EnsureURLScheme now recognizes mailto: and tel: regardless of letter case, so a capitalized support link is no longer turned into an https:// web URL.

Why

The prefix checks were case-sensitive. A support link entered as Mailto:support@example.com or TEL:+1234567890 (phone keyboards capitalize the first letter) came back as https://Mailto:support@example.com, which opens a broken web page instead of the mail or phone app. URL schemes are case-insensitive (RFC 3986), and ParseRemoteRoutingURL in the same file already accepts HTTPS://.

Type of change

  • Bug fix

Areas affected

  • Subscription (share links / Clash / JSON)

How was this tested?

Added two cases to TestEnsureURLScheme (Mailto:... and TEL:...). Both fail before the change ("https://Mailto:support@example.com") and pass after; go test ./internal/util/common/ passes.

Screenshots / recordings

N/A

Breaking changes

None

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. (I ran the internal/util/common package tests only.)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

Prepared with help from an AI coding assistant; I reviewed the change and ran the tests above.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/7052 **Author:** [@kevin9327](https://github.com/kevin9327) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/url-scheme-case` --- ### 📝 Commits (1) - [`f1bc46b`](https://github.com/MHSanaei/3x-ui/commit/f1bc46b50023722eb35582a9f20b836c6b5835dc) fix(url): keep capitalized mailto: and tel: links as they are ### 📊 Changes **2 files changed** (+7 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/util/common/url.go` (+5 -2) 📝 `internal/util/common/url_test.go` (+2 -0) </details> ### 📄 Description ## Summary `EnsureURLScheme` now recognizes `mailto:` and `tel:` regardless of letter case, so a capitalized support link is no longer turned into an `https://` web URL. ## Why The prefix checks were case-sensitive. A support link entered as `Mailto:support@example.com` or `TEL:+1234567890` (phone keyboards capitalize the first letter) came back as `https://Mailto:support@example.com`, which opens a broken web page instead of the mail or phone app. URL schemes are case-insensitive (RFC 3986), and `ParseRemoteRoutingURL` in the same file already accepts `HTTPS://`. ## Type of change - [x] Bug fix ## Areas affected - [x] Subscription (share links / Clash / JSON) ## How was this tested? Added two cases to `TestEnsureURLScheme` (`Mailto:...` and `TEL:...`). Both fail before the change (`"https://Mailto:support@example.com"`) and pass after; `go test ./internal/util/common/` passes. ## Screenshots / recordings N/A ## Breaking changes None ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. (I ran the `internal/util/common` package tests only.) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- _Prepared with help from an AI coding assistant; I reviewed the change and ran the tests above._ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:34:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6621
No description provided.