Skip to content

Commit 506a2f6

Browse files
authored
Fix a loopback check bug #26
Change logic of Loopback check so that it checks for any exemption for an app container with a matching name, instead of requiring exactly one (#26)
1 parent d830a9b commit 506a2f6

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/SharpWebview/Loopback.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@ public class Loopback
1818
/// <returns>True, if the exception is present.</returns>
1919
public bool IsWebViewLoopbackEnabled()
2020
{
21-
var webViewSid = GetWebViewAppContainerSid();
21+
var webViewSids = GetWebViewAppContainerSids();
2222
return GetAllAppContainerConfigs().Any(c =>
2323
{
2424
ConvertSidToStringSid(c.Sid, out var currentSid);
25-
return currentSid == webViewSid;
25+
return webViewSids.Any(webViewSid => currentSid == webViewSid);
2626
});
2727
}
2828

29-
private string GetWebViewAppContainerSid()
29+
private IEnumerable<string> GetWebViewAppContainerSids()
3030
{
31-
var webviewAppContainer = GetAllAppContainers()
32-
.SingleOrDefault(a => a.appContainerName.ToLower() == WebViewAppContainerName);
33-
ConvertSidToStringSid(webviewAppContainer.appContainerSid, out var webViewSid);
34-
return webViewSid;
31+
return GetAllAppContainers()
32+
.Where(a => a.appContainerName.ToLower() == WebViewAppContainerName)
33+
.Select(a => {
34+
ConvertSidToStringSid(a.appContainerSid, out var webViewSid);
35+
return webViewSid;
36+
});
3537
}
3638

3739
private List<FirewallAppContainer> GetAllAppContainers()

0 commit comments

Comments
 (0)