mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-07 04:55:00 +03:00
fix(fmt): keep a ':' in a Naive password through export and import (#10526)
NaiveFmt.ToUri percent-encodes the username and password, so a password-only profile with the password a:b is exported as naive+https://a%3Ab@host. Resolve decoded the user info before looking for the ':' separator and imported it as username "a", password "b". Split the raw user info first and decode each part. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,16 +30,17 @@ public class NaiveFmt : BaseFmt
|
||||
NaiveQuic = true,
|
||||
};
|
||||
}
|
||||
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
|
||||
// Split before decoding: ToUri percent-encodes a ':' inside the username or password.
|
||||
var rawUserInfo = parsedUrl.UserInfo;
|
||||
if (rawUserInfo.Contains(':'))
|
||||
{
|
||||
var split = rawUserInfo.Split(':', 2);
|
||||
item.Username = split[0];
|
||||
item.Password = split[1];
|
||||
item.Username = Utils.UrlDecode(split[0]);
|
||||
item.Password = Utils.UrlDecode(split[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Password = rawUserInfo;
|
||||
item.Password = Utils.UrlDecode(rawUserInfo);
|
||||
}
|
||||
|
||||
var query = Utils.ParseQueryString(parsedUrl.Query);
|
||||
|
||||
Reference in New Issue
Block a user