From 3b116fd3aedfe7737eb91b8db11351634efdd8ee Mon Sep 17 00:00:00 2001 From: Nick Krantz Date: Wed, 1 Oct 2025 09:18:29 -0500 Subject: [PATCH] remove unneeded string manipulation --- src/Api/Vault/Models/Request/CipherRequestModel.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Api/Vault/Models/Request/CipherRequestModel.cs b/src/Api/Vault/Models/Request/CipherRequestModel.cs index 8e226db6b7..f784f2cd73 100644 --- a/src/Api/Vault/Models/Request/CipherRequestModel.cs +++ b/src/Api/Vault/Models/Request/CipherRequestModel.cs @@ -124,7 +124,7 @@ public class CipherRequestModel } } - var userIdKey = userId.HasValue ? $"\"{userId.ToString().ToUpperInvariant()}\"" : null; + var userIdKey = userId.HasValue ? userId.ToString().ToUpperInvariant() : null; existingCipher.Reprompt = Reprompt; existingCipher.Key = Key; existingCipher.ArchivedDate = ArchivedDate; @@ -310,7 +310,6 @@ public class CipherRequestModel ? new Dictionary() : JsonSerializer.Deserialize>(existingJson) ?? new Dictionary(); - var userKey = userIdKey.Trim('"'); // Remove the key from the value when: // - new value is null // - new value is an empty or whitespace string @@ -321,11 +320,11 @@ public class CipherRequestModel if (shouldRemove) { - jsonDict.Remove(userKey); + jsonDict.Remove(userIdKey); } else { - jsonDict[userKey] = newValue is string str ? str.ToUpperInvariant() : newValue; + jsonDict[userIdKey] = newValue is string str ? str.ToUpperInvariant() : newValue; } return jsonDict.Count == 0 ? null : JsonSerializer.Serialize(jsonDict);