Caldav: fix 3433584, encode comma in LOCATION field
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1850 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
8f56aa80f0
commit
48e99f716d
|
@ -19,6 +19,7 @@
|
|||
package davmail.exchange;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -29,6 +30,12 @@ public class VProperty {
|
|||
KEY, PARAM_NAME, PARAM_VALUE, QUOTED_PARAM_VALUE, VALUE, BACKSLASH
|
||||
}
|
||||
|
||||
protected static final HashSet<String> MULTIVALUED_PROPERTIES = new HashSet<String>();
|
||||
static {
|
||||
MULTIVALUED_PROPERTIES.add("RESOURCES");
|
||||
MULTIVALUED_PROPERTIES.add("LOCATION");
|
||||
}
|
||||
|
||||
protected static class Param {
|
||||
String name;
|
||||
List<String> values;
|
||||
|
@ -139,7 +146,7 @@ public class VProperty {
|
|||
} else if (state == State.VALUE) {
|
||||
if (currentChar == '\\') {
|
||||
state = State.BACKSLASH;
|
||||
} else if (currentChar == ';' || ("RESOURCES".equals(key) && currentChar == ',')) {
|
||||
} else if (currentChar == ';' || (MULTIVALUED_PROPERTIES.contains(key) && currentChar == ',')) {
|
||||
addValue(line.substring(startIndex, i));
|
||||
startIndex = i + 1;
|
||||
}
|
||||
|
@ -382,7 +389,7 @@ public class VProperty {
|
|||
for (String value : values) {
|
||||
if (firstValue) {
|
||||
firstValue = false;
|
||||
} else if ("RESOURCES".equals(key)) {
|
||||
} else if (MULTIVALUED_PROPERTIES.contains(key)) {
|
||||
buffer.append(',');
|
||||
} else {
|
||||
buffer.append(';');
|
||||
|
@ -425,7 +432,7 @@ public class VProperty {
|
|||
char c = value.charAt(i);
|
||||
if (c == '\n') {
|
||||
buffer.append("\\n");
|
||||
} else if ("RESOURCES".equals(key) && c==',') {
|
||||
} else if (MULTIVALUED_PROPERTIES.contains(key) && c==',') {
|
||||
buffer.append('\\').append(',');
|
||||
} else {
|
||||
buffer.append(value.charAt(i));
|
||||
|
|
Loading…
Reference in New Issue