TheURL encoding used until now handled accented characters correctly, but special characters poorly. Some (such as ':', '/', ';') caused the display to crash. And the character encoding spec was generally poorly respected.
As a result, we've overhauled the way URL encoding is handled: the org.ametys.core.util.URLEncoder class you were using no longer exists, and has been replaced by org.ametys.core.util.URIUtils, which now handles decoding as well.
But more importantly, semantics have also been reviewed, and this is a case-by-case approach.
Example in the charter ODF :
BEFORE :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
xmlns:url="org.ametys.core.util.URLEncoder"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
url:encodePath(/view/content/@title), '.pdf')"/>
<a href="{$pdfUrl}"/>
xmlns:url="org.ametys.core.util.URLEncoder"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
url:encodePath(/view/content/@title), '.pdf')"/>
<a href="{$pdfUrl}"/>
xmlns:url="org.ametys.core.util.URLEncoder"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
url:encodePath(/view/content/@title), '.pdf')"/>
<a href="{$pdfUrl}"/>
The above code does not work with special characters. The name, which could potentially include special characters, must be encoded separately from the entireURL :
AFTER :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
xmlns:url="org.ametys.core.util.URIUtils"
xmlns:filename="org.ametys.core.util.FilenameUtils"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
filename:encodeName(/view/content/@title), '.pdf')"/>
<a href="{url:encodePath($pdfUrl)}"/>
xmlns:url="org.ametys.core.util.URIUtils"
xmlns:filename="org.ametys.core.util.FilenameUtils"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
filename:encodeName(/view/content/@title), '.pdf')"/>
<a href="{url:encodePath($pdfUrl)}"/>
xmlns:url="org.ametys.core.util.URIUtils"
xmlns:filename="org.ametys.core.util.FilenameUtils"
...
<!-- Url of PDF -->
<xsl:param name="pdfUrl" select="concat($uri-prefix,
'/plugins/odf-web/',
$site,
'/_content/',
/view/content/@name,
'/',
filename:encodeName(/view/content/@title), '.pdf')"/>
<a href="{url:encodePath($pdfUrl)}"/>
To migrate, you need to search for all the links you've created manually in your XSL (in particular those that can be downloaded) and see if they're affected.
DecodingURL
Deletion of the org.ametys.cms.transformation.xslt.URIDecoder class. This class was used incorrectly most of the time.
It has an impact on all the XSL in which it is used. You need to do a search to identify them all. Then delete the "xmlns" that references it, as well as the corresponding "exclude", usually just below it.
Then you need to replace all calls to this namespace (usually "decoder:decode") in the XSL in question. This can happen anywhere, but often in docbook2html or in FO exports. There are several possible scenarios here:
If this was used by htmlexpert, we would often get the construction: htmlexpertresolver:parseAndResolve(decoder:decode(.)). Simply remove decoder:decode: htmlexpertresolver:parseAndResolve(.)
If it was used by plugin forms (especially in html:textarea), a new Helper must be used: xmlns:forms="org.ametys.plugins.forms.xslt.FormsXSLTHelper" and replace decoder:decode with forms:decode
In other cases, it may be necessary to continue decoding. In this case, use URIUtils.decode with the namespace org.ametys.core.util.URIUtils
Research department
In the default rendering of search criteria, the XSL template named "criterion-enumeration-options" has been replaced by a "match" template with the "criterion-enumeration-options" mode.
Make the following changes to the rendering of the search service:
Replace
Oops!
Copy to clipboard failed. Open the code and copy it manually.