From d64868a44b1b077caba324a5fd0c2cc09b06fcb4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 11 Oct 2022 16:43:38 -0400 Subject: [PATCH] Fix downloads due to chunkSize not being defined --- web/includes/functions.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 3a90ce2ca..7ed103728 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2366,7 +2366,7 @@ function extract_auth_values_from_url($url) { return array( $username, $password ); } -function output_file($path) { +function output_file($path, $chunkSize=1024) { if (connection_status() != 0) return false; $parts = pathinfo($path); @@ -2378,12 +2378,11 @@ function output_file($path) { header("Content-Transfer-Encoding: binary"); header("Content-Type: $contentType"); - $contentDisposition = 'attachment'; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { - $fileName = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1); - header("Content-Disposition: $contentDisposition;filename=\"$file\""); - } else { - header("Content-Disposition: $contentDisposition;filename=\"$file\""); + $contentDisposition = 'inline'; + if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { + $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1); } + header("Content-Disposition: $contentDisposition;filename=\"$file\""); header('Accept-Ranges: bytes'); $range = 0; @@ -2400,7 +2399,7 @@ function output_file($path) { } else { $size2 = $size - 1; header("Content-Range: bytes 0-$size2/$size"); - header("Content-Length: " . $size); + header('Content-Length: ' . $size); } if ($size == 0) {