From 8a065356eaf669405473e7528f785f249487a81e Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 19 Jan 2017 10:27:02 -0400 Subject: [PATCH] HOR-2483 [MANTIS 21846] When output document is set to "Open the file" once click on the generated file link, the downloaded output document have an incorrect name. --- gulliver/system/class.g.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 6b593fb25..39e22b3ff 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -1232,8 +1232,10 @@ class G case 'txt': G::sendHeaders( $filename, 'text/html', $download, $downloadFileName ); break; - case 'doc': case 'pdf': + G::sendHeaders( $filename, 'application/pdf', $download, $downloadFileName ); + break; + case 'doc': case 'pm': case 'po': G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName ); @@ -1283,12 +1285,14 @@ class G { if ($download) { if ($downloadFileName == '') { - $aAux = explode( '/', $filename ); - $downloadFileName = $aAux[count( $aAux ) - 1]; + $aAux = explode('/', $filename); + $downloadFileName = $aAux[count($aAux) - 1]; } - header( 'Content-Disposition: attachment; filename="' . $downloadFileName . '"' ); + header('Content-Disposition: attachment; filename="' . $downloadFileName . '"'); + } else { + header('Content-Disposition: inline; filename="' . $downloadFileName . '"'); } - header( 'Content-Type: ' . $contentType ); + header('Content-Type: ' . $contentType); //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor. $userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] );