1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-04 14:52:24 -05:00

EWS: improve ItemId vs user provided item name detection

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2201 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-12-12 21:36:21 +00:00
parent 1c1f82c588
commit d25a2aa6cc

View File

@ -2443,8 +2443,16 @@ public class EwsExchangeSession extends ExchangeSession {
return dateFormatter.format(date);
}
/**
* Check if itemName is long and base64 encoded.
* User generated item names are usually short
* @param itemName item name
* @return true if itemName is an EWS item id
*/
protected static boolean isItemId(String itemName) {
return itemName.length() >= 152;
return itemName.length() >= 152
// item name is base64
&& itemName.matches("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$");
}