Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/Core/Vault/Services/Implementations/CipherService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ await _cipherRepository.UpdateAttachmentAsync(new CipherAttachment

// Update the revision date when an attachment is added
cipher.RevisionDate = DateTime.UtcNow;
await _cipherRepository.ReplaceAsync((CipherDetails)cipher);
if (cipher is CipherDetails cipherDetails)
{
await _cipherRepository.ReplaceAsync(cipherDetails);
}
else
{
await _cipherRepository.ReplaceAsync(cipher);
}

await _pushService.PushSyncCipherUpdateAsync(cipher, null);

Expand Down Expand Up @@ -287,7 +294,14 @@ public async Task CreateAttachmentAsync(Cipher cipher, Stream stream, string fil

// Update the revision date when an attachment is added
cipher.RevisionDate = DateTime.UtcNow;
await _cipherRepository.ReplaceAsync((CipherDetails)cipher);
if (cipher is CipherDetails cipherDetails)
{
await _cipherRepository.ReplaceAsync(cipherDetails);
}
else
{
await _cipherRepository.ReplaceAsync(cipher);
}

// push
await _pushService.PushSyncCipherUpdateAsync(cipher, null);
Expand Down Expand Up @@ -898,9 +912,13 @@ private async Task<DeleteAttachmentResponseData> DeleteAttachmentAsync(Cipher ci
{
await _cipherRepository.ReplaceAsync(cipher);
}
else if (cipher is CipherDetails cipherDetails)
{
await _cipherRepository.ReplaceAsync(cipherDetails);
}
else
{
await _cipherRepository.ReplaceAsync((CipherDetails)cipher);
await _cipherRepository.ReplaceAsync(cipher);
}

// push
Expand Down
Loading