[PM-33152] Fix: InvalidCastException on attachment upload as admin#7148
[PM-33152] Fix: InvalidCastException on attachment upload as admin#7148boris324 wants to merge 1 commit intobitwarden:mainfrom
Conversation
When AdminRequest is true, CiphersController fetches the cipher via GetOrganizationDetailsByIdAsync() which returns CipherOrganizationDetails. The hard cast to CipherDetails in CreateAttachmentForDelayedUploadAsync and CreateAttachmentAsync throws InvalidCastException. Use type checking with fallback to base ReplaceAsync(Cipher), matching the existing pattern already used in DeleteAttachmentAsync. Resolves bitwarden#7062
|
|
1 similar comment
|
|
|
Thank you for your contribution! We've added this to our internal tracking system for review. Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process. |
Summary
CipherOrganizationDetailscannot be cast toCipherDetailswhen admin uploads attachmentsReplaceAsync(Cipher)in two locations:CreateAttachmentForDelayedUploadAsync(line ~236)CreateAttachmentAsync(line ~290)DeleteAttachmentAsync(line ~897)Test plan