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:
parent
08f86575d5
commit
e195a5f5c8
@ -137,7 +137,7 @@ public class DavGatewayTray {
|
|||||||
defaultItem.addActionListener(settingsListener);
|
defaultItem.addActionListener(settingsListener);
|
||||||
popup.add(defaultItem);
|
popup.add(defaultItem);
|
||||||
|
|
||||||
MenuItem logItem = new MenuItem("Logs...");
|
MenuItem logItem = new MenuItem("Show logs...");
|
||||||
logItem.addActionListener(new ActionListener() {
|
logItem.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Logger rootLogger = Logger.getRootLogger();
|
Logger rootLogger = Logger.getRootLogger();
|
||||||
|
@ -1139,7 +1139,15 @@ public class ExchangeSession {
|
|||||||
.replaceAll("<\\?xml:namespace", "")
|
.replaceAll("<\\?xml:namespace", "")
|
||||||
.getBytes("UTF-8"));
|
.getBytes("UTF-8"));
|
||||||
XmlDocument xmlBody = tidyDocument(bais);
|
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
|
// use owa generated body to look for inline images
|
||||||
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");
|
List<Attribute> imgList = xmlDocument.getNodes("//img/@src");
|
||||||
@ -1174,10 +1182,10 @@ public class ExchangeSession {
|
|||||||
attachment.name = attachmentName;
|
attachment.name = attachmentName;
|
||||||
attachment.href = messageUrl + "/" + attachmentHref;
|
attachment.href = messageUrl + "/" + attachmentHref;
|
||||||
if (htmlBodyImgList.size() > inlineImageCount) {
|
if (htmlBodyImgList.size() > inlineImageCount) {
|
||||||
String contentid = htmlBodyImgList.get(inlineImageCount++).getValue();
|
String contentid = htmlBodyImgList.get(inlineImageCount++);
|
||||||
if (contentid.startsWith("cid:")) {
|
if (contentid.startsWith("cid:")) {
|
||||||
attachment.contentid = contentid.substring("cid:".length());
|
attachment.contentid = contentid.substring("cid:".length());
|
||||||
} else if (!contentid.startsWith("http://") && !contentid.startsWith("https://")) {
|
} else {
|
||||||
attachment.contentid = contentid;
|
attachment.contentid = contentid;
|
||||||
// must patch htmlBody for inline image without cid
|
// must patch htmlBody for inline image without cid
|
||||||
htmlBody = htmlBody.replaceFirst(attachment.contentid, "cid:" + attachment.contentid);
|
htmlBody = htmlBody.replaceFirst(attachment.contentid, "cid:" + attachment.contentid);
|
||||||
|
Loading…
Reference in New Issue
Block a user