logo

blog

My website can't be that messy, right? git clone https://hacktivis.me/git/blog.git
commit: 4fd6a2532ae52e882412e721887520bdda5308a1
parent 2692edd8187a5c533d7bddd2ffce5854fd5fc3e4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  7 Apr 2023 13:51:14 +0200

nginx_autoindex.xsl.in: Encode URIs via EXSLT

Diffstat:

Mnginx_autoindex.xsl.in6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nginx_autoindex.xsl.in b/nginx_autoindex.xsl.in @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0" xml:space="preserve"> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0" xml:space="preserve" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:import href="templates/en/nav.xsl"/> <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/list"><xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text> @@ -33,13 +33,13 @@ --> <xsl:template match="/list/directory"><tr> - <td><a href="{./text()}"><xsl:value-of select="./text()"/>/</a></td> + <td><a href="./{str:encode-uri(./text(), true(), 'UTF-8')}/"><xsl:value-of select="./text()"/>/</a></td> <td data-value="0" data-type="int">0 B</td> <td><xsl:value-of select="@mtime"/></td> </tr></xsl:template> <xsl:template match="/list/file"><tr> - <td><a href="{./text()}"><xsl:value-of select="./text()"/></a></td> + <td><a href="./{str:encode-uri(./text(), true(), 'UTF-8')}"><xsl:value-of select="./text()"/></a></td> <td data-type="int" data-value="{@size}"><xsl:value-of select="@size"/> B</td> <td><xsl:value-of select="@mtime"/></td> </tr></xsl:template>