From: Antonio Ospite <ao2@ao2.it>
Date: Fri, 16 Nov 2018 17:27:16 +0000 (+0100)
Subject: src/rss_converter_dilbert.com.xsl: fix generating enclosures
X-Git-Tag: v1.4.0~2
X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/c96f8af95c614476d3d6f9ba7330b938a2efedf0?ds=sidebyside;hp=--cc

src/rss_converter_dilbert.com.xsl: fix generating enclosures

Enclosures were not generated for Dilbert.com because the URL of the
picture are protocol-relative and curl cannot work with these URLs.

Fix the URLs by prepending a protocol schema to them.
---

c96f8af95c614476d3d6f9ba7330b938a2efedf0
diff --git a/src/rss_converter_dilbert.com.xsl b/src/rss_converter_dilbert.com.xsl
index fd30d35..94d7fef 100644
--- a/src/rss_converter_dilbert.com.xsl
+++ b/src/rss_converter_dilbert.com.xsl
@@ -79,7 +79,16 @@
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">
-                <xsl:copy-of select="php:functionString('Tweeper\Tweeper::generateEnclosure', $picture-url)"/>
+                <!--
+                    Dilbert.com uses protocol-relative urls for pictures but
+                    generateEnclosure() relies on curl which cannot work
+                    without a schema.
+
+                    Use http as protocol because curl gives some error when
+                    attempting TLS negotiation with the server where
+                    Dilbert.com assets are.
+                -->
+                <xsl:copy-of select="php:functionString('Tweeper\Tweeper::generateEnclosure', concat('http:', $picture-url))"/>
             </xsl:if>
         </item>
     </xsl:template>