From 876deaf9690878e74837db999b22fda2dbe0e1cf Mon Sep 17 00:00:00 2001 From: mguessan Date: Thu, 14 Jul 2011 21:35:17 +0000 Subject: [PATCH] Caldav: encode LF to %0A in urlcompname git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1733 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/util/StringUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/java/davmail/util/StringUtil.java b/src/java/davmail/util/StringUtil.java index f24a9fd1..55634e12 100644 --- a/src/java/davmail/util/StringUtil.java +++ b/src/java/davmail/util/StringUtil.java @@ -133,6 +133,7 @@ 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 URLENCODED_AMP_PATTERN = Pattern.compile("%26"); @@ -294,6 +295,9 @@ 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"); + } return result; }