Details

    • Fix Priority:
      2

      Description

      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.

        Issue Links

          Activity

          Hide
          sun Soeren Unruh added a comment -

          Maybe CalEventLocalServiceImpl.importICal4j() should also do some replacing of newlines in imported events' descriptions with BR tags.

          Show
          sun Soeren Unruh added a comment - Maybe CalEventLocalServiceImpl.importICal4j() should also do some replacing of newlines in imported events' descriptions with BR tags.
          Hide
          drew.blessing@esu10.org Drew Blessing (Inactive) added a comment -

          Soeren,

          Thank you for your report. As part of the community verifier program I am taking a look at this issue.

          Show
          drew.blessing@esu10.org Drew Blessing (Inactive) added a comment - Soeren, Thank you for your report. As part of the community verifier program I am taking a look at this issue.
          Hide
          drew.blessing@esu10.org Drew Blessing (Inactive) added a comment -

          I was able to reproduce this in Liferay 6.1 GA1.

          Steps:
          1. Create a calendar event with rich text.
          2. Export the calendar event and download the .ics file.
          3. Import .ics into a calendar program such as iCal.

          Observe the HTML tags in the description of the event.

          Show
          drew.blessing@esu10.org Drew Blessing (Inactive) added a comment - I was able to reproduce this in Liferay 6.1 GA1. Steps: 1. Create a calendar event with rich text. 2. Export the calendar event and download the .ics file. 3. Import .ics into a calendar program such as iCal. Observe the HTML tags in the description of the event.
          Hide
          michael.saechang Michael Saechang added a comment -

          Updated ticket as per Drew's comment. Thank you for verifying.

          Show
          michael.saechang Michael Saechang added a comment - Updated ticket as per Drew's comment. Thank you for verifying.
          Hide
          eduardo.lundgren Eduardo Lundgren added a comment -

          Old calendar.

          Show
          eduardo.lundgren Eduardo Lundgren added a comment - Old calendar.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 15 weeks, 1 day ago

                Development

                  Subcomponents