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

Combo servlet does not translate relative urls in CSS that have .min. in the filename

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 7.2.10 DXP FP7, 7.2.10 DXP FP8, 7.2.1 CE GA2
    • Fix Version/s: None
    • Component/s: Minifier
    • Labels:
      None
    • Fix Priority:
      1

      Description

      Combo servlet bundles/aggregates multiple CSS files into single downloads. Some of those CSS files might already have been minified, so those are not minified again.

      Apart from bundling multiple files, the Combo servlet and/or AggregateFilter also translate relative URLs used in CSS files so that they still work even though the location of the CSS file is now different (/combo?.... instead of /o/my-portlet/css/)

      The issue is: if an already minified CSS file contains a relative URL, this relative URL is not translated (because the file is skipped completely).

      Environment:

      • Liferay CE/DXP 7.2
      • No portal-developer.properties enabled (because that would effectively disable minifier completely)

      Reproduction:

      • Create a MVC portlet with a CSS file with a filename ending in .min.css
      • Use a relative URL in that css file, for example for a background image
      • Put an element in the view.jsp that gets this CSS rule applied
      • Put the portlet on a page

      Expected outcome:

      • CSS rule gets applied, background image is displayed
      • Inspection of the combo response that contains the minified css shows that the URL is translated into /o/myportlet/css/images/background.png

      Observed outcome:

      • CSS rule gets applied but image is not displayed
      • browser console shows a 404 for this background image, trying to load it from a URL relative to /combo (for example /images/background.png)
      • Inspection of the combo response that contains the minified CSS shows that the URL is not translated

      Attached you'll find a portlet (sources and jar) with a minimal example

        Attachments

          Activity

            People

            Assignee:
            alfonso.crisci Alfonso Crisci (Inactive)
            Reporter:
            gvanderploeg@iprofs.nl Geert van der Ploeg
            Participants of an Issue:
            Recent user:
            Alfonso Crisci (Inactive)
            Engineering Assignee:
            Alfonso Crisci (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              38 weeks ago

                Packages

                Version Package