aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-03-12 20:59:36 +0000
committerMario <mario@mariovavti.com>2023-03-12 20:59:36 +0000
commit38a1b791749a9cd8142e820231f84c4aee67998e (patch)
tree0c976603c3c759e3be9b34d51bead9c014fa23db /include
parent95cbcf30d7934ded1222c3481553536cbb95dbb3 (diff)
downloadvolse-hubzilla-38a1b791749a9cd8142e820231f84c4aee67998e.tar.gz
volse-hubzilla-38a1b791749a9cd8142e820231f84c4aee67998e.tar.bz2
volse-hubzilla-38a1b791749a9cd8142e820231f84c4aee67998e.zip
fix max_oembed_size check if content length header is an array (e.g. after a redirect with code 301) - fix issue #1727
Diffstat (limited to 'include')
-rw-r--r--include/oembed.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/oembed.php b/include/oembed.php
index bcf5d525c..fbe6a573b 100644
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -147,6 +147,7 @@ function oembed_fetch_url($embedurl){
$txt = Cache::get('[' . App::$videowidth . '] ' . $furl);
}
+
if(strpos(strtolower($embedurl),'.pdf') !== false && get_config('system','inline_pdf')) {
$action = 'allow';
$j = [
@@ -158,7 +159,6 @@ function oembed_fetch_url($embedurl){
// set $txt to something so that we don't attempt to fetch what could be a lengthy pdf.
$txt = EMPTY_STR;
}
-
if(is_null($txt)) {
$txt = EMPTY_STR;
@@ -177,12 +177,17 @@ function oembed_fetch_url($embedurl){
$headers = get_headers($furl, true);
- if (isset($headers['Content-Length']) && $headers['Content-Length'] > $max_oembed_size) {
- $action = 'block';
+ if (isset($headers['Content-Length'])) {
+ $content_length = ((is_array($headers['Content-Length'])) ? array_key_last($headers['Content-Length']) : $headers['Content-Length']);
+
+ if ($content_length > $max_oembed_size) {
+ $action = 'block';
+ }
}
}
if ($action !== 'block') {
+
// try oembed autodiscovery
$redirects = 0;
$result = z_fetch_url($furl, false, $redirects,