Do not decode attachment URL twice (fails with % in message title)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@104 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
44e4ebf07c
commit
3f7f9aca5c
|
@ -958,13 +958,12 @@ public class ExchangeSession {
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
throw new IOException(e + " " + e.getMessage());
|
throw new IOException(e + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
String decodedPath = URIUtil.decode(attachment.href);
|
|
||||||
|
|
||||||
if ("message/rfc822".equalsIgnoreCase(mimeHeader.contentType)) {
|
if ("message/rfc822".equalsIgnoreCase(mimeHeader.contentType)) {
|
||||||
String messageAttachmentPath = null;
|
String messageAttachmentPath = null;
|
||||||
|
|
||||||
// Get real attachment path from owa page content
|
// Get real attachment path from owa page content
|
||||||
GetMethod method = new GetMethod(URIUtil.encodePath(decodedPath));
|
GetMethod method = new GetMethod(URIUtil.encodePath(attachment.href));
|
||||||
wdr.retrieveSessionInstance().executeMethod(method);
|
wdr.retrieveSessionInstance().executeMethod(method);
|
||||||
String body = method.getResponseBodyAsString();
|
String body = method.getResponseBodyAsString();
|
||||||
final String URL_DECLARATION = "var g_szURL\t= \"";
|
final String URL_DECLARATION = "var g_szURL\t= \"";
|
||||||
|
@ -986,7 +985,7 @@ public class ExchangeSession {
|
||||||
attachedMessage.write(quotedOs);
|
attachedMessage.write(quotedOs);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
GetMethod method = new GetMethod(URIUtil.encodePath(decodedPath));
|
GetMethod method = new GetMethod(URIUtil.encodePath(attachment.href));
|
||||||
wdr.retrieveSessionInstance().executeMethod(method);
|
wdr.retrieveSessionInstance().executeMethod(method);
|
||||||
|
|
||||||
// encode attachment
|
// encode attachment
|
||||||
|
@ -1351,14 +1350,14 @@ public class ExchangeSession {
|
||||||
|
|
||||||
for (Attachment currentAttachment : attachments) {
|
for (Attachment currentAttachment : attachments) {
|
||||||
if ((partHeader.name != null && partHeader.name.equals(currentAttachment.name)) ||
|
if ((partHeader.name != null && partHeader.name.equals(currentAttachment.name)) ||
|
||||||
// TODO : test if .eml extension could be stripped from attachment name directly
|
// TODO : test if .eml extension could be stripped from attachment name directly
|
||||||
// try to get email attachment with .eml extension
|
// try to get email attachment with .eml extension
|
||||||
(partHeader.name != null && (partHeader.name + ".eml").equals(currentAttachment.name)) ||
|
(partHeader.name != null && (partHeader.name + ".eml").equals(currentAttachment.name)) ||
|
||||||
// try to get attachment by content id
|
// try to get attachment by content id
|
||||||
(partHeader.contentId != null && partHeader.contentId.equals(currentAttachment.contentid)) ||
|
(partHeader.contentId != null && partHeader.contentId.equals(currentAttachment.contentid)) ||
|
||||||
// try to get attachment with Content-Disposition header
|
// try to get attachment with Content-Disposition header
|
||||||
(partHeader.fileName != null && partHeader.fileName.equals(currentAttachment.name))
|
(partHeader.fileName != null && partHeader.fileName.equals(currentAttachment.name))
|
||||||
){
|
) {
|
||||||
attachment = currentAttachment;
|
attachment = currentAttachment;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue