mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5854] [MERGED] fix(ldap): convert default total GB to bytes when auto-creating clients #6008
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6008
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5854
Author: @mrnickson-hue
Created: 7/7/2026
Status: ✅ Merged
Merged: 7/8/2026
Merged by: @MHSanaei
Base:
main← Head:fix/ldap-sync-totalgb-bytes-conversion📝 Commits (2)
5e38afbfix(ldap): convert default total GB to bytes when auto-creating clients70f3b08test(ldap): pin the GB-to-bytes conversion in buildClient📊 Changes
2 files changed (+9 additions, -1 deletions)
View changed files
📝
internal/web/job/ldap_sync_job.go(+1 -1)📝
internal/web/job/ldap_sync_job_test.go(+8 -0)📄 Description
Summary
LdapSyncJob.buildClient(internal/web/job/ldap_sync_job.go) storedldapDefaultTotalGBdirectly intoClient.TotalGBwith no unit conversion:Every other place that takes a GB-denominated input and persists it into this byte-denominated field converts first:
ClientFormModal.tsx→gbToBytes(form.totalGB)tgbot_router.go→limitTraffic * 1024 * 1024 * 1024client_inbound_apply.go→totalGB * 1024 * 1024 * 1024So a "Default total (GB)" setting of
10was persisted as10bytes instead of10737418240bytes — the auto-created client hits its quota almost immediately.Fix
0still means unlimited (0 * anything = 0), consistent with every other path.Test plan
go build ./internal/web/job/...go test ./internal/web/job/...— existingTestLdapCreateClients_AttachesToAllConfiguredInboundspasses (usesdefGB=0, unaffected by the conversion)Closes #5852
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.