Skip to content

Fix Sub2API URL normalization for uploads#33

Open
NEKO-CwC wants to merge 1 commit intodou-jiang:mainfrom
NEKO-CwC:fix/sub2api-url-normalization
Open

Fix Sub2API URL normalization for uploads#33
NEKO-CwC wants to merge 1 commit intodou-jiang:mainfrom
NEKO-CwC:fix/sub2api-url-normalization

Conversation

@NEKO-CwC
Copy link
Copy Markdown

问题

自动上传 Sub2API 时,已保存的 api_url 会直接从数据库读取并传给 curl_cffi

如果 URL 中包含 端口 、尾部空格、换行或其他隐藏字符,curl 会把端口部分解析失败,并报错:

curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535

这会导致“测试连接可以通过,但自动上传失败”。

## 修复

- 在 Sub2API 上传和测试连接前,统一清洗并校验基础 URL
- 在创建和更新 Sub2API 服务时,对 URL 做规范化处理
- 在设置页保存 Sub2API 服务时,对输入内容执行 trim()

这样可以避免隐藏字符进入数据库,并兼容已保存的脏 URL 配置。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant