Menu

#1858 HtmlUnit does no longer process CSS files read from a file URL

Latest SVN
closed
RBRi
None
1
2017-03-09
2017-03-09
No

When the web client needs to load a CSS resource from a file URL, the content of the CSS file will be ignored beginning with HtmlUnit v2.25.

The reason is that for file resources the web client has to guess the content type of the resource from the name or the content of the file. Looks like URLConnection, which is used for that purpose, does a poor job when it comes to detecting CSS resources. As a consequence, the resulting content type will be "application/octet-stream".

Since HtmlUnit v2.25, CSSStyleSheet.loadStylesheet() performs a content type check before trying to parse a CSS snippet, and resources with content type "application/octet-stream" will hence be ignored.

Discussion

  • Joerg Werner

    Joerg Werner - 2017-03-09

    A quick-fix could be to add a similar special handling for CSS resources as it already exists for JS resources to WebClient.guessContentType(). See the attached patch.

     
  • RBRi

    RBRi - 2017-03-09
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2017-03-09

    Fixed in SVN. Thanks for the report. SNAPSHOT build update is on the way.

     
  • RBRi

    RBRi - 2017-03-09
    • status: accepted --> closed
     
  • RBRi

    RBRi - 2017-03-09

    a new snapshot build is available....

     

Log in to post a comment.