Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-33399

incorrect Blog Atom/RSS encoding: Portal URL replacement done on text only

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
    • Fix Version/s: None
    • Labels:
      None
    • Fix Priority:
      3

      Description

      Steps to reproduce:

      1. create a blog entry. Pretend you're blogging about HTML, use the following text:

      If you link to server-relative files you can do it like <a href="/some-file">this</a> or, with image, like <img src="/some-file.png"/> this

      (Note that this is the actual HTML text, not the source!)
      2. access the blog's RSS feed. The text you'll find in there (with the default "full content" displayed) is:

      If you link to server-relative files you can do it like <a href="http://localhost:8080/some-file">this</a> or, with image, like <img src="http://localhost:8080/some-file.png"/> this

      (or whatever your current portal URL is).

      The offending code is from BlogsEntryServiceImpl:

      if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) {
      	... // shortened
      }
      else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) {
      	value = StringPool.BLANK;
      }
      else {
      	value = StringUtil.replace(
      		entry.getContent(),
      		new String[] {
      			"href=\"/", "src=\"/"
      		},
      		new String[] {
      			"href=\"" + themeDisplay.getURLPortal() + "/",
      			"src=\"" + themeDisplay.getURLPortal() + "/"
      		});
      }

      i.e. blind replacement of the href and src sequences, no matter if they're markup or text.

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              olaf.kock Olaf Kock
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                4 years, 22 weeks, 1 day ago