Skip to content

Commit 9ffa6a4

Browse files
authored
Remove formatted spaces from extra JSON before URL encoding (2dust#8385)
1 parent 386209b commit 9ffa6a4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,23 @@ protected static int ToUriQuery(ProfileItem item, string? securityDef, ref Dicti
118118
}
119119
if (item.Extra.IsNotEmpty())
120120
{
121-
dicQuery.Add("extra", Utils.UrlEncode(item.Extra));
121+
var extra = item.Extra;
122+
try
123+
{
124+
var node = JsonNode.Parse(item.Extra);
125+
if (node != null)
126+
{
127+
extra = node.ToJsonString(new JsonSerializerOptions
128+
{
129+
WriteIndented = false,
130+
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
131+
});
132+
}
133+
}
134+
catch
135+
{
136+
}
137+
dicQuery.Add("extra", Utils.UrlEncode(extra));
122138
}
123139
break;
124140

0 commit comments

Comments
 (0)