Another attempt to resolve local urls

This commit is contained in:
Matthew Exon 2024-06-30 10:44:04 +01:00 committed by Matthew Exon
parent 59de855d0f
commit 7417ce0ad1
2 changed files with 3 additions and 3 deletions

View file

@ -671,7 +671,7 @@ function retriever_globalise_urls(DOMDocument $doc, array $resource) {
return $doc;
}
$rooturl = $components['scheme'] . "://" . $components['host'];
$dirurl = $rooturl . dirname($components['path']) . "/";
$dirurl = $rooturl . dirname($components['path']);
$params = array('$dirurl' => $dirurl, '$rooturl' => $rooturl);
$fix_urls_template = Renderer::getMarkupTemplate('fix-urls.tpl', 'addon/retriever/');
$fix_urls_xslt = Renderer::replaceMacros($fix_urls_template, $params);

View file

@ -14,7 +14,7 @@
<xsl:template match="*/@src[starts-with(.,'.')]">
<xsl:attribute name="src">
<xsl:value-of select="concat('{{$dirurl}}',.)"/>
<xsl:value-of select="concat('{{$dirurl}}/',.)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/@src[starts-with(.,'/')]">
@ -22,7 +22,7 @@
<xsl:value-of select="concat('{{$rooturl}}',.)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/@src[not(contains(.,':'))]">
<xsl:template match="*/@src[not(starts-with(.,'/')) and not(contains(.,':'))]">
<xsl:attribute name="src">
<xsl:value-of select="concat('{{$dirurl}}',.)"/>
</xsl:attribute>