fix: AnyTLS 重复解码密码

This commit is contained in:
xream committed 2026-10-25 09:40:09 +08:00
1 parent b409a222a8
commit 8c3fc5767d
2 files changed
+17 -1

No files matched your search

@@ -2130,7 +2130,6 @@ function URI_AnyTLS() {
// eslint-disable-next-line no-unused-vars
let [__, password, server, port, addons = '', name] =
/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line);
password = decodeURIComponent(password);
port = parseInt(`${port}`, 10);
if (isNaN(port)) {
port = 443;
@@ -5817,6 +5817,23 @@ describe('Proxy text producers', function () {
expect(parsed.password).to.equal('p@ss:w/rd#1?');
});
for (const password of ['p%40ss', 'p%ss']) {
it(`round-trips the URI AnyTLS password ${password}`, function () {
const output = produceExternal('URI', {
type: 'anytls',
name: 'URI AnyTLS Password',
server: 'anytls.example.com',
port: 443,
password,
sni: 'anytls.example.com',
});
const parsed = ProxyUtils.parse(output);
expect(parsed).to.have.length(1);
expect(parsed[0].password).to.equal(password);
});
}
it('produces URI Trojan links with vcn from the sidecar', function () {
const output = produceExternal('URI', {
type: 'trojan',