aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-06-25 04:09:07 -0700
committerredmatrix <git@macgirvin.com>2016-06-25 04:10:48 -0700
commit1924459abd970e1581ca3c9de7328073906b4268 (patch)
tree4d2ee944822f2ba842942742c2d5659501e5209c
parent1577efa25e0dff2fdd8f2ffa6e0750ceac2dfe44 (diff)
downloadvolse-hubzilla-1924459abd970e1581ca3c9de7328073906b4268.tar.gz
volse-hubzilla-1924459abd970e1581ca3c9de7328073906b4268.tar.bz2
volse-hubzilla-1924459abd970e1581ca3c9de7328073906b4268.zip
media (e.g. video) files weren't being detected correctly in oembed, causing the stream to try and load large videos (and failing)
-rwxr-xr-xinclude/oembed.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/include/oembed.php b/include/oembed.php
index 08363e488..e968a8f65 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -25,12 +25,6 @@ function oembed_action($embedurl) {
logger('oembed_action: ' . $embedurl, LOGGER_DEBUG, LOG_INFO);
- // These media files should now be caught in bbcode.php
- // left here as a fallback in case this is called from another source
-
- $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm","opus");
- $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
-
if(strpos($embedurl,'http://') === 0) {
if(intval(get_config('system','embed_sslonly'))) {
$action = 'block';
@@ -119,14 +113,19 @@ function oembed_fetch_url($embedurl){
// These media files should now be caught in bbcode.php
// left here as a fallback in case this is called from another source
- $noexts = array("mp3","mp4","ogg","ogv","oga","ogm","webm","opus");
- $ext = pathinfo(strtolower($embedurl),PATHINFO_EXTENSION);
+ $noexts = array(".mp3",".mp4",".ogg",".ogv",".oga",".ogm",".webm",".opus");
$result = oembed_action($embedurl);
$embedurl = $result['url'];
$action = $result['action'];
+ foreach($noexts as $ext) {
+ if(strpos(strtolower($embedurl),$ext) !== false) {
+ $action = 'block';
+ }
+ }
+
$txt = null;
if($action !== 'block') {
@@ -151,7 +150,7 @@ function oembed_fetch_url($embedurl){
}
- if (! in_array($ext, $noexts) && $action !== 'block') {
+ if ($action !== 'block') {
// try oembed autodiscovery
$redirects = 0;
$result = z_fetch_url($furl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));