mirror of
https://github.com/bitwarden/server
synced 2026-01-07 02:53:38 +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:
@@ -113,18 +113,25 @@ public class CipherRequestModel
|
||||
|
||||
if (hasAttachments2)
|
||||
{
|
||||
foreach (var attachment in attachments.Where(a => Attachments2.ContainsKey(a.Key)))
|
||||
foreach (var attachment in attachments)
|
||||
{
|
||||
var attachment2 = Attachments2[attachment.Key];
|
||||
if (!Attachments2.TryGetValue(attachment.Key, out var attachment2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
attachment.Value.FileName = attachment2.FileName;
|
||||
attachment.Value.Key = attachment2.Key;
|
||||
}
|
||||
}
|
||||
else if (hasAttachments)
|
||||
{
|
||||
foreach (var attachment in attachments.Where(a => Attachments.ContainsKey(a.Key)))
|
||||
foreach (var attachment in attachments)
|
||||
{
|
||||
attachment.Value.FileName = Attachments[attachment.Key];
|
||||
if (!Attachments.TryGetValue(attachment.Key, out var attachmentForKey))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
attachment.Value.FileName = attachmentForKey;
|
||||
attachment.Value.Key = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user