Commit f9ed695f authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'B6929-savePdf-copy-instead-of-move' into 'master'

B6929 - Treat single file argument like several file argument (savePdf: copy,…

See merge request !94
parents cba1abd2 7a6b570b
Pipeline #1014 passed with stage
in 1 minute and 37 seconds
......@@ -795,7 +795,7 @@ class Save {
}
$overwrite = isset($formElement[FE_FILE_REPLACE_MODE]) && $formElement[FE_FILE_REPLACE_MODE] == FE_FILE_REPLACE_MODE_ALWAYS;
Support::copyFile($srcFile, $pathFileName, $overwrite, $chmodDir);
Support::moveFile($srcFile, $pathFileName, $overwrite, $chmodDir);
// If given, get chmodFile. Needs to be prefixed with a 0 (=octal) - it should not be quoted! Symbolic mode is not allowed. E.g.: 0660, or 01777
if (empty($formElement[FE_FILE_CHMOD_FILE])) {
......
......@@ -1282,8 +1282,7 @@ class Support {
* @param bool|int $chmodDir , 'false' if not change
* @throws UserFormException
*/
public
static function copyFile($srcFile, $pathFileName, $overwrite, $chmodDir = false) {
public static function moveFile($srcFile, $pathFileName, $overwrite, $chmodDir = false) {
if (file_exists($pathFileName)) {
if ($overwrite) {
......
......@@ -117,15 +117,9 @@ class Download {
}
}
switch (count($files)) {
case 0:
return '';
case 1:
return $files[0];
default:
break;
}
if (count($files) === 0) return '';
// Need to create a separate result file, even if it is just a single file (#6929)
$concatFile = HelperFile::tempnam();
if (false === $concatFile) {
throw new DownloadException('Error creating output file.', ERROR_DOWNLOAD_CREATE_NEW_FILE);
......
......@@ -812,7 +812,7 @@ class Report {
} else {
$download = new Download();
$file = $download->process($vars, OUTPUT_MODE_FILE);
Support::copyFile($file, $pathFileName, true);
Support::moveFile($file, $pathFileName, true);
}
break;
......
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