[BUGFIX] Media element cannot handle plain external URL
authorOliver Hader <oliver@typo3.org>
Mon, 16 Apr 2012 20:23:52 +0000 (22:23 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 17 Apr 2012 19:40:21 +0000 (21:40 +0200)
The media element cannot handle a plain external URL that does
not use any provider like Youtube or Google. Since the URL is
not found locally and no provider can be determined, the
resolved result stays empty.

Change-Id: Ib3a4b017877fdde7189f784b90cbc37cb98efa19
Fixes: #36177
Releases: 6.0, 4.7
Reviewed-on: http://review.typo3.org/10554
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/cms/tslib/content/class.tslib_content_media.php

index 853717a..1361018 100644 (file)
@@ -260,18 +260,20 @@ class tslib_content_Media extends tslib_content_Abstract {
        protected function retrieveMediaUrl($file) {
                $returnValue = NULL;
 
+               /** @var $mediaWizard tslib_mediaWizardProvider */
+               $mediaWizard = tslib_mediaWizardManager::getValidMediaWizardProvider($file);
+
+                       // Get the path relative to the page currently outputted
                if (is_file(PATH_site . $file)) {
-                               // get the path relative to the page currently outputted
                        $returnValue = $GLOBALS['TSFE']->tmpl->getFileName($file);
-               } else {
-                               // Use media wizard to extract file from URL
-                       /** @var $mediaWizard tslib_mediaWizardProvider */
-                       $mediaWizard = tslib_mediaWizardManager::getValidMediaWizardProvider($file);
-                       if ($mediaWizard !== NULL) {
-                               $returnValue = $this->cObj->typoLink_URL(array(
-                                       'parameter' => $mediaWizard->rewriteUrl($file)
-                               ));
-                       }
+                       // Use media wizard to extract file from URL
+               } elseif ($mediaWizard !== NULL) {
+                       $returnValue = $this->cObj->typoLink_URL(array(
+                               'parameter' => $mediaWizard->rewriteUrl($file)
+                       ));
+                       // Use URL if it is valid and has a scheme
+               } elseif (t3lib_div::isValidUrl($file)) {
+                       $returnValue = $file;
                }
 
                return $returnValue;