mirror of
https://github.com/bitwarden/server
synced 2026-01-08 03:23:20 +00:00
[PM-14476] Avoid multiple lookups in dictionaries (#4973)
* Avoid multiple lookups in dictionaries * Consistency in fallback to empty CollectionIds * Readability at the cost of lines changed * Readability * Changes after running dotnet format
This commit is contained in:
@@ -637,9 +637,9 @@ public static class CoreHelpers
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!globalSettings.SelfHosted && httpContext.Request.Headers.ContainsKey(RealConnectingIp))
|
||||
if (!globalSettings.SelfHosted && httpContext.Request.Headers.TryGetValue(RealConnectingIp, out var realConnectingIp))
|
||||
{
|
||||
return httpContext.Request.Headers[RealConnectingIp].ToString();
|
||||
return realConnectingIp.ToString();
|
||||
}
|
||||
|
||||
return httpContext.Connection?.RemoteIpAddress?.ToString();
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class LoggerFactoryExtensions
|
||||
{
|
||||
return true;
|
||||
}
|
||||
var eventId = e.Properties.ContainsKey("EventId") ? e.Properties["EventId"].ToString() : null;
|
||||
var eventId = e.Properties.TryGetValue("EventId", out var eventIdValue) ? eventIdValue.ToString() : null;
|
||||
if (eventId?.Contains(Constants.BypassFiltersEventId.ToString()) ?? false)
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user