mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6961] [Bug]: 后台修改基础路径后,更新版本,路径会被重置。 #4600
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#4600
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?
Originally created by @igsood on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6961
Describe the bug
后台修改基础路径后,更新版本,路径会被重置成新的基础路径。
版本:3.10.2
How to reproduce the problem
后台修改基础路径后,更新版本,路径会被重置成新的基础路径。
版本:3.10.2
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.10.2
Xray-core version
No response
How did you install 3x-ui?
Other (please describe in the bug body)
Operating system
ubuntu 24.04
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No response
Before submitting
@github-actions[bot] commented on GitHub (Oct 26, 2026):
结论:如果您设置的基础路径(去掉开头的
/之后)不足 4 个字符,例如/、/a/、/ab/,那么更新脚本会把它当作"缺失或过短",静默替换成一个随机的 18 位新路径——这正是您看到的现象,并且在最新的 v3.11.0 中依然存在。如果您的路径长度 ≥ 4 个字符,则不是这个原因,请按文末回复两个信息。原因
面板内"更新"按钮和
x-ui菜单里的"更新"都会执行同一个update.sh(internal/web/service/panel/panel.go:44、x-ui.sh:151)。脚本先读出当前路径,去掉开头的/:然后只按长度判断:
SetBasePath存储时总会加上首尾/(internal/web/service/setting.go:822-829),所以面板里存为/ab/的路径,在这里会变成ab/,长度为 3,于是被覆盖。而后台设置页对长度没有任何限制,只校验开头必须是/(frontend/src/schemas/setting.ts:5),因此用户可以保存一个后台认为合法、但每次更新都会被替换的路径。您现在可以做的
/mypanel/),之后更新就不会再被替换。WebBasePath is missing or too short. Generating a new one...,就说明是这个原因。需要您补充
x-ui菜单更新,还是重新运行install.sh)?——如果是 Docker 且数据库没有挂载到持久卷,所有设置都会在重建容器时丢失,那是另一个原因。Suggested fix: 在
update.sh中只在路径确实为空或仍是默认/时才生成新路径,因为更新时需要替换的只有未设置的默认值;用户自己保存的短路径应当保留,最多打印一条警告。install.sh:1350的已安装分支也需要同样的修改。如果更希望强制最小长度,就应在后台设置页保存时校验,而不是在更新时静默覆盖。此回复由自动分析生成,维护者可能会进一步跟进。
@HamedSanaei commented on GitHub (Oct 26, 2026):
Root cause confirmed and fix submitted.
The installation/update scripts use a path-length check to detect an uninitialized
webBasePath. Unfortunately, this also matches valid short custom paths such as/a/and/ab/, causing them to be replaced with a newly generated random path.A similar problem was previously reported in #5179. Commit
f88f53cfixed the restart/desynchronization behavior, but the underlying path-overwrite condition remained.I've submitted a focused fix that preserves valid custom paths, retains secure initialization for missing/default paths, and adds regression coverage for the affected scenarios.
PR: https://github.com/MHSanaei/3x-ui/pull/6964