Bug 300246 ��� also fix attachment menu; r/sr=Neil

This commit is contained in:
mnyromyr%tprac.de 2007-07-11 20:43:28 +00:00
Родитель 625a3284bb
Коммит f87db2abe6
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -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);