[
https://issues.apache.org/jira/browse/MYFACES-4787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153033#comment-18153033
]
Thomas Andraschko commented on MYFACES-4787:
--------------------------------------------
[~volosied] can you check pls?
> ui:include of SVG files fails with InvalidFileException
> -------------------------------------------------------
>
> Key: MYFACES-4787
> URL: https://issues.apache.org/jira/browse/MYFACES-4787
> Project: MyFaces Core
> Issue Type: Improvement
> Affects Versions: 5.0.0, 4.1.4
> Reporter: Milan Siebenbürger
> Priority: Minor
>
> Since 4.1.4 (and others), DefaultFaceletFactory rejects include/decorate
> targets whose suffix is not one of the configured Facelet suffixes,
> FACELETS_VIEW_MAPPINGS entries, or the built-in defaults (.xhtml, .html,
> .jsf, .faces).
> A common pattern that now fails is inlining SVG icons so they can be styled
> from page CSS (e.g. .link:hover svg \{ ... }), which does not work with <img>
> / h:graphicImage:
>
> {code:java}
> <ui:include src="/images/icon.svg"/>
> InvalidFileException: Invalid path provided: /images/icon.svg
> {code}
> This is partially addressed in MYFACES-4780 (5aa14b8 on 4.1.x, 2cdd57ad4 on
> main): .html, .jsf and .faces are now always allowed, which covers the common
> Facelets-related suffixes. Non-Facelets XML content such as .svg is still
> rejected, so the issue remains on current 4.1.x and main.
> The only workaround today is adding *.svg to
> jakarta.faces.FACELETS_VIEW_MAPPINGS. That param has a different purpose,
> though, and using it this way has side effects: it restricts which view IDs
> the Facelets VDL handles, and with prefix mapping (/faces/*) it makes
> /faces/images/icon.svg requestable as a view.
> Proposal:
> 1. Add a context param, e.g.
> org.apache.myfaces.FACELETS_ADDITIONAL_INCLUDE_SUFFIXES (space-separated),
> appended to the allowed set. The default stays unchanged, so the hardening is
> kept and extending it is an explicit opt-in.
> 2. Optionally add .svg to the built-in defaults, since inline SVG is a common
> use case.
> Binary formats are not affected (they never parsed as Facelets), so this only
> concerns XML-based content such as .svg or .xml fragments.
> I'm happy to provide a PR (4.1.x + main, backports as needed) once we agree
> on the approach.
>
> Milan Siebenbürger
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)