[PR #6050] [MERGED] fix(clients): allow case-only email updates without duplicates #6063

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6050
Author: @H-TTTTT
Created: 7/20/2026
Status: ✅ Merged
Merged: 7/21/2026
Merged by: @MHSanaei

Base: main ← Head: fix/email-case-update


📝 Commits (1)

  • a948b0a fix(clients): allow case-only email updates without duplicates

📊 Changes

2 files changed (+33 additions, -1 deletions)

View changed files

📝 internal/web/service/client_inbound_apply.go (+3 -1)
📝 internal/web/service/client_update_rename_test.go (+30 -0)

📄 Description

Summary

  • Rename the clients row on any byte-level email change in UpdateInboundClient, not only when !strings.EqualFold.
  • Prevents case-only edits (test → Test) from creating a duplicate row and then failing with UNIQUE constraint failed: clients.email.

Root cause

  1. Rename gate used EqualFold → skipped case-only renames.
  2. SyncInbound looks up by exact email → creates a new record for Test.
  3. Fallback rename in ClientService.Update then collides with the new row.

Test plan

  • go test ./internal/web/service/ -run 'TestUpdateInboundClient.*Rename|TestClientUpdateDuplicate'
  • Panel: edit client email test → Test → single row, no SQL error
  • Full rename old@x → new@x still works

Fixes #5951


🔄 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/6050 **Author:** [@H-TTTTT](https://github.com/H-TTTTT) **Created:** 7/20/2026 **Status:** ✅ Merged **Merged:** 7/21/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/email-case-update` --- ### 📝 Commits (1) - [`a948b0a`](https://github.com/MHSanaei/3x-ui/commit/a948b0ad77766d92d2e3ce06058beae065c10fd6) fix(clients): allow case-only email updates without duplicates ### 📊 Changes **2 files changed** (+33 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/client_inbound_apply.go` (+3 -1) 📝 `internal/web/service/client_update_rename_test.go` (+30 -0) </details> ### 📄 Description ## Summary - Rename the `clients` row on any byte-level email change in `UpdateInboundClient`, not only when `!strings.EqualFold`. - Prevents case-only edits (`test` → `Test`) from creating a duplicate row and then failing with `UNIQUE constraint failed: clients.email`. ## Root cause 1. Rename gate used `EqualFold` → skipped case-only renames. 2. `SyncInbound` looks up by exact email → creates a new record for `Test`. 3. Fallback rename in `ClientService.Update` then collides with the new row. ## Test plan - [x] `go test ./internal/web/service/ -run 'TestUpdateInboundClient.*Rename|TestClientUpdateDuplicate'` - [ ] Panel: edit client email `test` → `Test` → single row, no SQL error - [ ] Full rename `old@x` → `new@x` still works Fixes #5951 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:07 +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#6063
No description provided.