1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

remove external images from body image list before inline images iteration

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@26 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-02-08 08:00:17 +00:00
parent 08f86575d5
commit e195a5f5c8
2 changed files with 12 additions and 4 deletions

View File

@ -137,7 +137,7 @@ public class DavGatewayTray {
defaultItem.addActionListener(settingsListener);
popup.add(defaultItem);
MenuItem logItem = new MenuItem("Logs...");
MenuItem logItem = new MenuItem("Show logs...");
logItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Logger rootLogger = Logger.getRootLogger();

View File

@ -1139,7 +1139,15 @@ public class ExchangeSession {
.replaceAll("<\\?xml:namespace", "")
.getBytes("UTF-8"));
XmlDocument xmlBody = tidyDocument(bais);
List<Attribute> htmlBodyImgList = xmlBody.getNodes("//img/@src");
List<Attribute> htmlBodyAllImgList = xmlBody.getNodes("//img/@src");
// remove absolute images from body img list
List<String> htmlBodyImgList = new ArrayList<String>();
for (Attribute imgAttribute:htmlBodyAllImgList) {
String value = imgAttribute.getValue();
if (!value.startsWith("http://") && !value.startsWith("https://")) {
htmlBodyImgList.add(value);
}
}
// use owa generated body to look for inline images
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");
@ -1174,10 +1182,10 @@ public class ExchangeSession {
attachment.name = attachmentName;
attachment.href = messageUrl + "/" + attachmentHref;
if (htmlBodyImgList.size() > inlineImageCount) {
String contentid = htmlBodyImgList.get(inlineImageCount++).getValue();
String contentid = htmlBodyImgList.get(inlineImageCount++);
if (contentid.startsWith("cid:")) {
attachment.contentid = contentid.substring("cid:".length());
} else if (!contentid.startsWith("http://") && !contentid.startsWith("https://")) {
} else {
attachment.contentid = contentid;
// must patch htmlBody for inline image without cid
htmlBody = htmlBody.replaceFirst(attachment.contentid, "cid:" + attachment.contentid);