From 731ea00d188e021b2bbf224d088154ce146d54cd Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 30 Nov 2017 03:38:43 +0000 Subject: [PATCH] substituted _ for , in composing a file name for Contentent-Disposition in codepot_readfile --- codepot/src/codepot/helpers/codepot_helper.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codepot/src/codepot/helpers/codepot_helper.php b/codepot/src/codepot/helpers/codepot_helper.php index 32aaaf64..fb80ae7c 100644 --- a/codepot/src/codepot/helpers/codepot_helper.php +++ b/codepot/src/codepot/helpers/codepot_helper.php @@ -531,13 +531,18 @@ if ( ! function_exists('codepot_readfile')) $size = filesize($location); $time = date('r',filemtime($location)); + // some browser don't like a comma in Content-Disposition + $fn = $filename; + $fn = str_replace (',', '_', $fn); + $fn = str_replace (';', '_', $fn); + if ($size <= 0) { header("Content-Type: $mimeType"); header('Cache-Control: public, must-revalidate, max-age=0'); header('Pragma: no-cache'); header("Content-Length: $size"); - header("Content-Disposition: $disposition; filename=$filename"); + header("Content-Disposition: $disposition; filename=$fn"); header('Content-Transfer-Encoding: binary'); header('Connection: close'); header("Last-Modified: $time"); @@ -582,7 +587,7 @@ if ( ! function_exists('codepot_readfile')) header('Accept-Ranges: bytes'); header('Content-Length:' . ($end - $begin)); header("Content-Range: bytes $begin-" . ($end - 1) . "/$size"); - header("Content-Disposition: $disposition; filename=$filename"); + header("Content-Disposition: $disposition; filename=$fn"); header("Content-Transfer-Encoding: binary"); header("Last-Modified: $time"); header('Connection: close');