diff --git a/retriever/retriever.php b/retriever/retriever.php index c0f6f935e..31db037ea 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -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); diff --git a/retriever/templates/fix-urls.tpl b/retriever/templates/fix-urls.tpl index 1d59938c3..ae2452fcd 100644 --- a/retriever/templates/fix-urls.tpl +++ b/retriever/templates/fix-urls.tpl @@ -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>