Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 996232 - [B2G][Email] Downloading large attachments will result in t... #18387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/email/js/cards/message_reader.js
Expand Up @@ -844,10 +844,14 @@ MessageReaderCard.prototype = {
var attachment = body.attachments[iAttach], state;
var extension = attachment.filename.split('.').pop();

var MAX_ATTACHMENT_SIZE = 1024 * 1024;

if (attachment.isDownloaded)
state = 'downloaded';
else if (!attachment.isDownloadable)
state = 'nodownload';
else if (attachment.sizeEstimateInBytes > MAX_ATTACHMENT_SIZE)
state = 'toolarge';
else if (MimeMapper.isSupportedType(attachment.mimetype) ||
MimeMapper.isSupportedExtension(extension))
state = 'downloadable';
Expand Down
2 changes: 2 additions & 0 deletions apps/email/js/cards/msg/attachment_item.html
Expand Up @@ -2,6 +2,8 @@
<span class="msg-attachment-icon"></span>
<span class="msg-attachment-filename"></span>
<span class="msg-attachment-filesize"></span>
<span data-l10n-id="message-attachment-too-large"
class="msg-attachment-too-large"></span>
<button class="msg-attachment-download">
<span class="icon icon-download"></span></button>
<span class="msg-attachment-downloading">
Expand Down
2 changes: 2 additions & 0 deletions apps/email/locales/email.en-US.properties
Expand Up @@ -282,6 +282,8 @@ attachment-size-kib={{kilobytes}}K

message-attachment-view.textContent=View

message-attachment-too-large=This file is too large to download.

message-no-subject=(no subject)

message-edit-menu-star=Star
Expand Down
12 changes: 12 additions & 0 deletions apps/email/style/message_cards.css
Expand Up @@ -278,6 +278,18 @@ input.msg-search-text-tease {
.msg-attachment-item[state="downloaded"] > .msg-attachment-view {
display: inline-block;
}

.msg-attachment-too-large { display: none; }
.msg-attachment-item[state="toolarge"] { height: auto; }
.msg-attachment-item[state="toolarge"] > .msg-attachment-too-large {
display: block;
color: rgba(0, 0, 0, 0.5);
margin-top: -2.5rem;
margin-bottom: -2.5rem;
line-height: 1.4rem;
padding-left: 2.2rem;
}

.msg-attachment-icon {
background: url("images/icons/message-list-attachment.png") no-repeat center / 2rem;
display: inline-block;
Expand Down