Bug #239741 --> Unable to forward messages. regression caused by my earlier checkin to AddAttachment

This commit is contained in:
scott%scott-macgregor.org 2004-04-05 21:59:53 +00:00
Родитель cc61d9c881
Коммит bb2237662e
1 изменённых файлов: 12 добавлений и 2 удалений

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

@ -2317,17 +2317,27 @@ function AddAttachment(attachment)
item.setAttribute("class", "listitem-iconic");
var url = gIOService.newURI(attachment.url, null, null);
url = url.QueryInterface( Components.interfaces.nsIURL );
try
{
url = url.QueryInterface( Components.interfaces.nsIURL );
}
catch (ex)
{
url = null;
}
// for local file urls, we are better off using the full file url because moz-icon will
// actually resolve the file url and get the right icon from the file url. All other urls, we should
// try to extract the file name from them. This fixes issues were an icon wasn't showing up if you dragged
// a web url that had a query or reference string after the file name and for mailnews urls were the filename
// is hidden in the url as a &filename= part.
if (url.fileName && !url.schemeIs("file"))
if (url && url.fileName && !url.schemeIs("file"))
item.setAttribute("image", "moz-icon://" + url.fileName);
else
item.setAttribute("image", "moz-icon:" + attachment.url);
bucket.appendChild(item);
}
}