mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
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#5912
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/5525
Author: @rqzbeh
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/24/2026
Merged by: @MHSanaei
Base:
main← Head:fix/tunnel-rewriteport-null📝 Commits (1)
34f37defix(inbounds): accept null rewritePort in tunnel settings (#5516)📊 Changes
2 files changed (+32 additions, -1 deletions)
View changed files
📝
frontend/src/schemas/protocols/inbound/tunnel.ts(+6 -1)➕
frontend/src/test/tunnel-rewriteport.test.ts(+26 -0)📄 Description
Summary
Fix a validation crash when the tunnel inbound's Rewrite port field is cleared. Closes #5516.
Why
When the Rewrite port field is cleared, Ant Design's
InputNumberwritesnullinto the form store (its standard behavior for an empty numeric field). The advanced JSON tab reflects this as"rewritePort": null.On save, the tunnel schema declared:
Zod's
.optional()permitsundefinedbut notnull, so the form-storenullwas rejected withsettings.rewritePort — Invalid input. The only workaround was to manually delete therewritePortkey in the JSON editor (which sets the value toundefined).The fix accepts
nulland collapses it toundefined, so the field is omitted from the serialized payload — matching the deleted-key behavior:The trailing
.optional()keeps the key optional in the inferred type (a bare.transform()would make it required and break the default-settings factory).Type of change
Areas affected
How was this tested?
frontend/src/test/tunnel-rewriteport.test.tscovering:null→ omitted, missing → omitted, valid port preserved, out-of-range still rejected.npm run typecheckandnpm run lintpass.npm run genproduces no diff (codegen gate clean).{ rewritePort: null }and{}both parse to{};8443is preserved;70000is rejected.Breaking changes
None. A previously-crashing input (
null) now parses to "port omitted"; all valid ports behave as before.Checklist
npm run lint,npm run typecheckpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.