[PR #6580] [MERGED] fix(sub): keep serverDescription literal in external link fragments #6360

Closed
opened 2026-11-02 04:08:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6580
Author: @sdhfsl
Created: 9/17/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: fix-external-remark-desc


📝 Commits (9)

  • 959e6fd fix(panel): accept 2FA codes from adjacent TOTP windows
  • f3096bb fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode
  • 198ac75 Merge branch 'main' into main
  • acb0297 Merge branch 'MHSanaei:main' into main
  • 35b92a1 Merge branch 'MHSanaei:main' into main
  • a4c8c8a fix(sub): keep serverDescription literal in external link fragments
  • c2868a7 Merge branch 'main' into fix-external-remark-desc
  • ab60fcd Merge remote-tracking branch 'origin/main' into pr-6580
  • f9a1436 refactor(sub): share one serverDescription fragment split across link paths

📊 Changes

3 files changed (+60 additions, -13 deletions)

View changed files

📝 internal/sub/external_config.go (+1 -1)
➕ internal/sub/external_remark_test.go (+40 -0)
📝 internal/sub/service.go (+19 -12)

📄 Description

Problem

Fixes #6575.

Client external links (kind: link) go through applyRemarkToLink, which escaped the whole remark: ?serverDescription=<base64> became %3F...%2F..., so Happ no longer recognises the parameter and the subtitle disappears. Inbound/host links were already fixed for this in #6488 (appendQueryAndFragment splits on ?serverDescription=); external rows use a different path that was missed.

Fix

New escapeRemarkFragment mirrors the #6488 split: escape only the display name, keep a clean base64 tail literal (validated: non-empty, decodes, no spaces/newlines/#/&). Malformed tails fall back to full escaping. vmess path untouched.

Tests

New TestApplyRemarkKeepsServerDescription (issue's exact example incl. emoji) and TestApplyRemarkMalformedServerDescriptionFallsBack. Mutation-checked (split removed -> the good test fails with the exact over-escaped output from the issue, restored -> green). Full internal/sub suite passes, go vet + gofmt clean.


🔄 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/6580 **Author:** [@sdhfsl](https://github.com/sdhfsl) **Created:** 9/17/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix-external-remark-desc` --- ### 📝 Commits (9) - [`959e6fd`](https://github.com/MHSanaei/3x-ui/commit/959e6fd62b07efd1038d70ecc18c3bc59ce2e3c2) fix(panel): accept 2FA codes from adjacent TOTP windows - [`f3096bb`](https://github.com/MHSanaei/3x-ui/commit/f3096bb3c1e3091647101d80939da52ab054b21d) fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode - [`198ac75`](https://github.com/MHSanaei/3x-ui/commit/198ac751d71b3b063a61b59efed80d50444febbf) Merge branch 'main' into main - [`acb0297`](https://github.com/MHSanaei/3x-ui/commit/acb0297c9b95da9d4157e751fe2789e851b34746) Merge branch 'MHSanaei:main' into main - [`35b92a1`](https://github.com/MHSanaei/3x-ui/commit/35b92a16d3770ee1c0351a1f5db75b635788fa32) Merge branch 'MHSanaei:main' into main - [`a4c8c8a`](https://github.com/MHSanaei/3x-ui/commit/a4c8c8ab5d47995764137c24c2993a5cb5b53ee5) fix(sub): keep serverDescription literal in external link fragments - [`c2868a7`](https://github.com/MHSanaei/3x-ui/commit/c2868a763a9c98e1c92b4db6cbb27d6b3e48cfc4) Merge branch 'main' into fix-external-remark-desc - [`ab60fcd`](https://github.com/MHSanaei/3x-ui/commit/ab60fcd28f00180bfec65df63de246daa9937ce7) Merge remote-tracking branch 'origin/main' into pr-6580 - [`f9a1436`](https://github.com/MHSanaei/3x-ui/commit/f9a1436ab4c36834917e3d07a4a2cc9bd57e5ca9) refactor(sub): share one serverDescription fragment split across link paths ### 📊 Changes **3 files changed** (+60 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `internal/sub/external_config.go` (+1 -1) ➕ `internal/sub/external_remark_test.go` (+40 -0) 📝 `internal/sub/service.go` (+19 -12) </details> ### 📄 Description ## Problem Fixes #6575. Client external links (`kind: link`) go through `applyRemarkToLink`, which escaped the whole remark: `?serverDescription=<base64>` became `%3F...%2F...`, so Happ no longer recognises the parameter and the subtitle disappears. Inbound/host links were already fixed for this in #6488 (`appendQueryAndFragment` splits on `?serverDescription=`); external rows use a different path that was missed. ## Fix New `escapeRemarkFragment` mirrors the #6488 split: escape only the display name, keep a clean base64 tail literal (validated: non-empty, decodes, no spaces/newlines/`#`/`&`). Malformed tails fall back to full escaping. vmess path untouched. ## Tests New `TestApplyRemarkKeepsServerDescription` (issue's exact example incl. emoji) and `TestApplyRemarkMalformedServerDescriptionFallsBack`. Mutation-checked (split removed -> the good test fails with the exact over-escaped output from the issue, restored -> green). Full `internal/sub` suite passes, `go vet` + gofmt clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08: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#6360
No description provided.