Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-10801

</HTML> tag added systematically on a rendition generated using freemarker engine

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.6
    • Fix Version/s: 5.6.0-HF10, 5.7.1
    • Component/s: Renditions

      Description

      if you create a template with a .txt file with freemarker instructions and then generate it using freemarker rendering engine in a "Deliver"rendition, then the freemarker engine adds a </html> at the end of the generated file. This </html> element should not exist.

      Furthermore, the generated filename is in .html it should keep the original extension (here .txt)

        Activity

        Hide
        Thierry Delprat added a comment -

        Problem is easily reproductible when using the Web UI.
        But, in unit test I can not reproduce the issue.

        This probably means that it is caused by a JSF filter that tries force valid html (and obviously fails).

        Show
        Thierry Delprat added a comment - Problem is easily reproductible when using the Web UI. But, in unit test I can not reproduce the issue. This probably means that it is caused by a JSF filter that tries force valid html (and obviously fails).
        Hide
        Thierry Delprat added a comment - - edited
        • the code returns a StringBlog that has text/html as mime-type
        • then ComponentUtils is called to handle the download and set the HttpResponse mime type
          response.setContentType(blob.getMimeType());
        • then some tidy like filter will be applied to ensure valide HTML and correct ajax management

        NB : the presence of this filter is the very reason why we have a /nxbigfile/ url pattern that uses a manual Servlet binding rather than a Seam binding.

        There are 2 points :

        don't set the MimeType in the Blob :

        I can look to improve this, but this is not the real issue.

        disable filter processing for this kind of requests

        Ideally, the ComponentUtils should disable the filter so that we don't have other side effects.

        Show
        Thierry Delprat added a comment - - edited the code returns a StringBlog that has text/html as mime-type then ComponentUtils is called to handle the download and set the HttpResponse mime type response.setContentType(blob.getMimeType()); then some tidy like filter will be applied to ensure valide HTML and correct ajax management NB : the presence of this filter is the very reason why we have a /nxbigfile/ url pattern that uses a manual Servlet binding rather than a Seam binding. There are 2 points : don't set the MimeType in the Blob : I can look to improve this, but this is not the real issue. disable filter processing for this kind of requests Ideally, the ComponentUtils should disable the filter so that we don't have other side effects.
        Show
        Thierry Delprat added a comment - Filter does not have any visible disable flag that could be set at Response level ... http://grepcode.com/file/repository.jboss.org/maven2/org.richfaces.framework/richfaces-impl/3.2.1.GA/org/ajax4jsf/webapp/BaseXMLFilter.java#BaseXMLFilter.doXmlFilter%28javax.servlet.FilterChain%2Cjavax.servlet.http.HttpServletRequest%2Cjavax.servlet.http.HttpServletResponse%29
        Hide
        Thierry Delprat added a comment -
        Show
        Thierry Delprat added a comment - Added Auto-detection of mime type in the FM renderer https://github.com/nuxeo/nuxeo-template-rendering/commit/40aeae93bc681d37d3a523a47a7f7c97057836bf
        Show
        Thierry Delprat added a comment - 5.6.0 backport : https://github.com/nuxeo/nuxeo-template-rendering/commit/85c78ab8028ce548c21bdedfa72d15759024d4d2
        Hide
        Thierry Delprat added a comment -

        Attached corrected jar.

        Show
        Thierry Delprat added a comment - Attached corrected jar.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: