mirror of
https://github.com/2dust/v2rayN.git
synced 2025-09-11 20:50:08 +00:00
fix: 修正获取系统hosts (#7903)
- 修复当host的记录存在行尾注释时,无法将其添加到dns.host中 示例hosts ``` 127.0.0.1 test1.com 127.0.0.1 test2.com # test ``` 在之前仅仅会添加`127.0.0.1 test1.com`这条记录,而忽略另一条
This commit is contained in:
parent
04195c2957
commit
0770e30034
1 changed files with 2 additions and 2 deletions
|
@ -582,9 +582,9 @@ public class Utils
|
||||||
if (host.StartsWith("#"))
|
if (host.StartsWith("#"))
|
||||||
continue;
|
continue;
|
||||||
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (hostItem.Length != 2)
|
if (hostItem.Length < 2)
|
||||||
continue;
|
continue;
|
||||||
systemHosts.Add(hostItem.Last(), hostItem.First());
|
systemHosts.Add(hostItem[1], hostItem[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue