-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.1.0 CE GA1, 7.0.X, 7.1.X, 7.2.X, Master
-
Fix Version/s: 7.0.10.13 DXP SP13, 7.0.X, 7.1.X, 7.2.X, 7.3.0 CE GA1, 7.3.1 CE GA2, 7.3.10 DXP GA1, Master
-
Component/s: Calendar
-
Branch Version/s:7.2.x, 7.1.x, 7.0.x
-
Backported to Branch:Committed
-
Fix Priority:2
-
Git Pull Request:
CalEventLocalServiceImpl.toICalVEvent() simply adds the description to the resulting iCal4j VEvent by calling new Description(event.getDescription()).
This leads to HTML markup embedded in the calendar export since the implementation of LPS-7966.
HTML markup needs to be removed from the description suring export or replaced with newlines/tabs in some cases.
The following code snippet could be an indication on what could be possibly done:
String descriptionStr = event.getDescription(); descriptionStr = StringUtil.trim(description); descriptionStr = description.replaceAll("\r|\n|\t", StringPool.BLANK); descriptionStr = description.replaceAll("(?i) ", StringPool.SPACE); descriptionStr = description.replaceAll("(?i)<li>", "\n* "); descriptionStr = description.replaceAll("(?i)<dd>", "\n\t"); descriptionStr = description.replaceAll("(?i)<td>", "\t"); descriptionStr = description.replaceAll("(?i)<a.+href=\"(.+)\"(?:/>|>.*</a>)", "$1"); descriptionStr = description.replaceAll("(?i)</?(?:br|p|div|h.|dt|tr)/?>(?!$)", StringPool.NEW_LINE); descriptionStr = HtmlUtil.unescape(description); descriptionStr = HtmlUtil.stripHtml(description); descriptionStr = description.replaceAll("(?:\\n\\s*)+", StringPool.NEW_LINE); Description description = new Description(descriptionStr);
In addition the HTML version of the description could be added in the X-ALT-DESC property to allow calendars like Outlook to still show the full HTML.
final XProperty altDesc = new XProperty("X-ALT-DESC", event.getDescription()); altDesc.getParameters().add(new XParameter("FMTTYPE", "text/html")); eventProps.add(altDesc);
We have performed a short test in Outlook 2007 with this snippet.
- causes
-
LPS-129410 Calendar invite .ics attachment does not contain HTML for X-ALT-DESC
- Closed
- relates
-
LPS-38700 After exporting the calendar event, the link’s text and URL are separated
- Closed