mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 19:22:22 -05:00
Caldav: new CRLF in urlcompname patch for EWS, use _x000D__x000A_ as encoded value
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1744 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
7bd0cbc5d0
commit
7a31659473
@ -1174,6 +1174,9 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
// workaround for missing urlcompname in Exchange 2010
|
||||
if (itemName == null) {
|
||||
itemName = StringUtil.base64ToUrl(itemId.id) + ".EML";
|
||||
} else if (itemName.indexOf('\n') >= 0) {
|
||||
// encode line feed
|
||||
itemName = itemName.replaceAll("\n", "_x000D__x000A_");
|
||||
}
|
||||
String instancetype = response.get(Field.get("instancetype").getResponseName());
|
||||
boolean isrecurring = "true".equals(response.get(Field.get("isrecurring").getResponseName()));
|
||||
|
@ -133,7 +133,8 @@ public final class StringUtil {
|
||||
private static final Pattern GT_PATTERN = Pattern.compile(">");
|
||||
|
||||
private static final Pattern QUOTE_PATTERN = Pattern.compile("\"");
|
||||
private static final Pattern LF_PATTERN = Pattern.compile("\n");
|
||||
private static final Pattern CR_PATTERN = Pattern.compile("\r");
|
||||
private static final Pattern LF_PATTERN = Pattern.compile("\n");
|
||||
|
||||
private static final Pattern URLENCODED_AMP_PATTERN = Pattern.compile("%26");
|
||||
|
||||
@ -142,6 +143,8 @@ public final class StringUtil {
|
||||
private static final Pattern ENCODED_GT_PATTERN = Pattern.compile(">");
|
||||
|
||||
private static final Pattern F8FF_PATTERN = Pattern.compile("_xF8FF_");
|
||||
private static final Pattern X0D0A_PATTERN = Pattern.compile("_x000D__x000A_");
|
||||
|
||||
private static final Pattern PLUS_PATTERN = Pattern.compile("\\+");
|
||||
private static final Pattern COLON_PATTERN = Pattern.compile(":");
|
||||
private static final Pattern SLASH_PATTERN = Pattern.compile("/");
|
||||
@ -213,6 +216,12 @@ public final class StringUtil {
|
||||
if (result.indexOf('"') >= 0) {
|
||||
result = QUOTE_PATTERN.matcher(result).replaceAll(""");
|
||||
}
|
||||
if (result.indexOf('\r') >=0) {
|
||||
result = CR_PATTERN.matcher(result).replaceAll("
");
|
||||
}
|
||||
if (result.indexOf('\n') >=0) {
|
||||
result = LF_PATTERN.matcher(result).replaceAll("
");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -295,8 +304,8 @@ public final class StringUtil {
|
||||
if (result.indexOf('"') >= 0) {
|
||||
result = QUOTE_PATTERN.matcher(result).replaceAll("%22");
|
||||
}
|
||||
if (result.indexOf('\n') >= 0) {
|
||||
result = LF_PATTERN.matcher(result).replaceAll("%0A");
|
||||
if (result.indexOf("_x000D__x000A_") >= 0) {
|
||||
result = X0D0A_PATTERN.matcher(result).replaceAll("\r\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user