From f87db2abe6362169e01093a36baffae1519ed93a Mon Sep 17 00:00:00 2001 From: "mnyromyr%tprac.de" Date: Wed, 11 Jul 2007 20:43:28 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20300246=20=EF=BF=BD=EF=BF=BD=EF=BF=BD=20al?= =?UTF-8?q?so=20fix=20attachment=20menu;=20r/sr=3DNeil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/content/msgHdrViewOverlay.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/mailnews/base/resources/content/msgHdrViewOverlay.js b/mailnews/base/resources/content/msgHdrViewOverlay.js index 401686056d1..4b9639a875e 100644 --- a/mailnews/base/resources/content/msgHdrViewOverlay.js +++ b/mailnews/base/resources/content/msgHdrViewOverlay.js @@ -1159,6 +1159,16 @@ function handleAttachmentSelection(commandPrefix) selectedAttachments[0].attachment[commandPrefix](); } +function createAttachmentDisplayName(aAttachment) +{ + // Strip any white space at the end of the display name to avoid + // attachment name spoofing (especially Windows will drop trailing dots + // and whitespace from filename extensions). Leading and internal + // whitespace will be taken care of by the crop="center" attribute. + // We must not change the actual filename, though. + return aAttachment.displayName.replace(/\s+$/, ""); +} + function displayAttachmentsForExpandedView() { var numAttachments = currentAttachments.length; @@ -1171,12 +1181,7 @@ function displayAttachmentsForExpandedView() var attachment = currentAttachments[index]; // create a listitem for the attachment listbox - // Strip any white space at the end of the display name to avoid - // attachment name spoofing (especially Windows will drop trailing dots - // and whitespace from filename extensions). Leading and internal - // whitespace will be taken care of by the crop="center" attribute. - // We must not change the actual filename, though. - var displayName = attachment.displayName.replace(/\s+$/, ""); + var displayName = createAttachmentDisplayName(attachment); var item = attachmentList.appendItem(displayName, ""); item.setAttribute("crop", "center"); item.setAttribute("class", "listitem-iconic attachment-item"); @@ -1289,9 +1294,10 @@ function addAttachmentToPopup(popup, attachment, attachmentIndex) item = popup.insertBefore(item, popup.childNodes[attachmentIndex - 1]); item.setAttribute('class', 'menu-iconic attachment-item'); + var displayName = createAttachmentDisplayName(attachment); var formattedDisplayNameString = gMessengerBundle.getFormattedString("attachmentDisplayNameFormat", - [attachmentIndex, attachment.displayName]); - + [attachmentIndex, displayName]); + item.setAttribute("crop", "center"); item.setAttribute('label', formattedDisplayNameString); item.setAttribute('accesskey', attachmentIndex);