diff --git a/libs/common/src/vault/models/view/cipher.view.ts b/libs/common/src/vault/models/view/cipher.view.ts
index 07992b8d656..852970725c2 100644
--- a/libs/common/src/vault/models/view/cipher.view.ts
+++ b/libs/common/src/vault/models/view/cipher.view.ts
@@ -275,11 +275,14 @@ export class CipherView implements View, InitializerMetadata {
return undefined;
}
- const attachments = obj.attachments?.map((a) => AttachmentView.fromSdkAttachmentView(a)) ?? [];
+ const attachments = obj.attachments?.map((a) => AttachmentView.fromSdkAttachmentView(a)!) ?? [];
if (obj.attachmentDecryptionFailures?.length) {
obj.attachmentDecryptionFailures.forEach((attachment) => {
- attachments.push(AttachmentView.fromSdkAttachmentView(attachment, true)!);
+ const attachmentView = AttachmentView.fromSdkAttachmentView(attachment, true);
+ if (attachmentView) {
+ attachments.push(attachmentView);
+ }
});
}
diff --git a/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.html b/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.html
index dd888e140cd..9308d2599ae 100644
--- a/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.html
+++ b/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.html
@@ -4,53 +4,72 @@
@for (attachment of attachments; track attachment.id) {
-
-
-
-
- {{ getAttachmentFileName(attachment) }}
-
- @if (!attachment.hasDecryptionError) {
+ @if (!attachment.hasDecryptionError) {
+
+
+
+ {{ attachment.fileName }}
+
{{ attachment.sizeName }}
- }
- @if (!attachment.hasDecryptionError && attachment.key == null) {
-
- }
-
-
-
-
- @if (attachment.key != null) {
-
- } @else if (!attachment.hasDecryptionError) {
-
+ @if (attachment.key == null) {
+
}
-
-
-
-
-
-
+
+
+
+
+ @if (attachment.key != null) {
+
+ } @else {
+
+ }
+
+
+
+
+
+
+ } @else {
+
+
+
+ {{ "errorCannotDecrypt" | i18n }}
+
+
+
+
+
+
+
+
+
+ }
}
diff --git a/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.ts b/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.ts
index ecd534fceb9..f75611b995e 100644
--- a/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.ts
+++ b/libs/vault/src/cipher-form/components/attachments/cipher-attachments.component.ts
@@ -190,14 +190,6 @@ export class CipherAttachmentsComponent {
}
}
- getAttachmentFileName(attachment: AttachmentView): string {
- if (attachment.hasDecryptionError) {
- return this.i18nService.t("errorCannotDecrypt");
- }
-
- return attachment.fileName ?? "";
- }
-
/** Save the attachments to the cipher */
submit = async () => {
this.onUploadStarted.emit();