Skip to content

Commit

Permalink
[Backport 4.2.x] Formatters / Properly detect URL ending in 1,2,3 or 5 (
Browse files Browse the repository at this point in the history
#8564)

* Formatters / Properly detect URL ending in 1,2,3 or 5 

Fixes #8226

* Update utility-tpl.xsl

---------

Co-authored-by: François Prunayre <[email protected]>
  • Loading branch information
geonetworkbuild and fxprunayre authored Dec 16, 2024
1 parent 5e80dc5 commit 04eed35
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/src/main/webapp/xslt/common/utility-tpl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="2.0">

<xsl:template name="replaceString">
Expand Down Expand Up @@ -125,8 +126,10 @@

<xsl:template name="hyperlink">
<xsl:param name="string" select="." />
<xsl:variable name="regex" as="xs:string">((http|https|ftp)://[^\s()]+[^\s\[\]`!(){};:'\\".,?«»“”‘’])</xsl:variable>

<xsl:analyze-string select="$string"
regex="(http|https|ftp)://[^\s()&gt;&lt;]+[^\s`!()\[\]&amp;#123;&amp;#125;;:'&apos;&quot;.,&gt;&lt;?«»“”‘’]">
regex="{$regex}">
<xsl:matching-substring>
<a href="{.}">
<xsl:value-of select="." />
Expand Down

0 comments on commit 04eed35

Please sign in to comment.