Commit 060075a6 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes bug that no mime_type_content is called if there is on file.

parent dc1410b7
Pipeline #2757 passed with stages
in 4 minutes and 10 seconds
......@@ -7080,7 +7080,7 @@ Parameter and (element) sources
* *uid*: `uid:<tt-content record id>` - the tt_content.uid of a QFQ PageContent record (shown on hover in the backend). This will render
only the specified QFQ content record, without any Typo3 layout elements (Menu, Body,...)
QFQ will retrieve the tt-content's bodytext from the Typo3 database, parse it, and render it as a PDF. Parameters can be
passed: `uid:<tt-content record id>[?arg1=value1][&arg2=value2][...]` and will be available in the SIP store for the QFQ PageContent,
passed: `uid:<tt-content record id>[&arg1=value1][&arg2=value2][...]` and will be available in the SIP store for the QFQ PageContent,
or passed as wkhtmltopdf arguments, if applicable.
* *WKHTML Options* for `page`, `urlParam` or `url`:
......
......@@ -222,19 +222,19 @@ class Download {
/**
* Get the mimetype of $filename and store them in $rcMimetype.
* Checks if the extension of $outputFilename fit's to the mimetype. If not, append the mimetype extension.
*
* @param string $filename
* @param string $pathFileName
* @param string $outputFilename
* @param string $rcMimetype
*
* @return string possible updated $outputFilename, according the mimetype.
*/
private
function targetFilenameExtension($filename, $outputFilename, &$rcMimetype) {
private function targetFilenameExtension($pathFileName, $outputFilename, &$rcMimetype) {
$rcMimetype = mime_content_type($filename);
if ($pathFileName != '' && file_exists($pathFileName)) {
$rcMimetype = mime_content_type($pathFileName);
}
return $outputFilename;
}
......@@ -245,8 +245,7 @@ class Download {
* @param $outputFilename
* @throws \DownloadException
*/
private
function outputFile($file, $outputFilename) {
private function outputFile($file, $outputFilename) {
$json = '';
$flagJson = ($this->getOutputFormat() === DOWNLOAD_OUTPUT_FORMAT_JSON);
......@@ -295,14 +294,16 @@ class Download {
* @throws \CodeException
* @throws \DbException
* @throws \DownloadException
* @throws \UserFormException
* @throws \UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
* @throws \UserFormException
* @throws \UserReportException
*/
private
function getElement($element, $downloadMode, &$rcData) {
private function getElement($element, $downloadMode, &$rcData) {
$filename = '';
$rcArgs = array();
......@@ -391,8 +392,7 @@ class Download {
* @throws \UserFormException
* @throws \UserReportException
*/
private
function getEvaluatedBodyText($uid, $urlParam) {
private function getEvaluatedBodyText($uid, $urlParam) {
foreach ($urlParam as $key => $paramValue) {
$this->store->setVar($key, $paramValue, STORE_SIP);
}
......@@ -415,8 +415,7 @@ class Download {
* @return string ZIP filename - has to be deleted later.
* @throws \DownloadException
*/
private
function zipFiles(array $files) {
private function zipFiles(array $files) {
$zipFile = HelperFile::tempnam();
if (false === $zipFile) {
......@@ -462,14 +461,16 @@ class Download {
* @throws \CodeException
* @throws \DbException
* @throws \DownloadException
* @throws \UserFormException
* @throws \UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
* @throws \UserFormException
* @throws \UserReportException
*/
private
function doElements(array $vars, $outputMode) {
private function doElements(array $vars, $outputMode) {
$tmpFiles = array();
......@@ -590,8 +591,7 @@ class Download {
* @throws \UserFormException
* @throws \UserReportException
*/
private
function doThumbnail($urlParam) {
private function doThumbnail($urlParam) {
$thumbnail = new Thumbnail();
$pathFilenameThumbnail = $thumbnail->process($urlParam, THUMBNAIL_VIA_DOWNLOAD);
......@@ -609,14 +609,16 @@ class Download {
* @throws \CodeException
* @throws \DbException
* @throws \DownloadException
* @throws \UserFormException
* @throws \UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws \Twig\Error\LoaderError
* @throws \Twig\Error\RuntimeError
* @throws \Twig\Error\SyntaxError
* @throws \UserFormException
* @throws \UserReportException
*/
public
function process($vars, $outputMode = OUTPUT_MODE_DIRECT) {
public function process($vars, $outputMode = OUTPUT_MODE_DIRECT) {
if (!is_array($vars)) {
$vars = $this->store->getStore(STORE_SIP);
......@@ -630,16 +632,14 @@ class Download {
/**
* @param $outputFormat
*/
private
function setOutputFormat($outputFormat) {
private function setOutputFormat($outputFormat) {
$this->outputFormat = $outputFormat;
}
/**
* @return string - DOWNLOAD_OUTPUT_FORMAT_RAW | DOWNLOAD_OUTPUT_FORMAT_JSON
*/
public
function getOutputFormat() {
public function getOutputFormat() {
return $this->outputFormat;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment