Skip to content

Commit 120e8d0

Browse files
committed
Fixed a bug in parsing subscription result
2dust#7734
1 parent 186b56a commit 120e8d0

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

v2rayN/ServiceLib/Handler/ConfigHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,11 @@ private static async Task<int> AddBatchServers4Custom(Config config, string strD
14121412
{
14131413
profileItem = V2rayFmt.ResolveFull(strData, subRemarks);
14141414
}
1415+
//Is Html Page
1416+
if (profileItem is null && HtmlPageFmt.IsHtmlPage(strData))
1417+
{
1418+
return -1;
1419+
}
14151420
//Is Clash configuration
14161421
if (profileItem is null)
14171422
{

v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,7 @@ protected static int ResolveStdTransport(NameValueCollection query, ref ProfileI
220220

221221
protected static bool Contains(string str, params string[] s)
222222
{
223-
foreach (var item in s)
224-
{
225-
if (str.Contains(item, StringComparison.OrdinalIgnoreCase))
226-
{
227-
return true;
228-
}
229-
}
230-
return false;
223+
return s.All(item => str.Contains(item, StringComparison.OrdinalIgnoreCase));
231224
}
232225

233226
protected static string WriteAllText(string strData, string ext = "json")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using SkiaSharp;
2+
3+
namespace ServiceLib.Handler.Fmt;
4+
5+
public class HtmlPageFmt : BaseFmt
6+
{
7+
public static bool IsHtmlPage(string strData)
8+
{
9+
return Contains(strData, "<html", "<!doctype html", "<head");
10+
}
11+
}

0 commit comments

Comments
 (0)