Commit 7a6b570b authored by Elias Villiger's avatar Elias Villiger
Browse files

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

B6929 - Treat single file argument like several file argument (savePdf: copy, not move) - refs #6929, closes #6929
parent 8203e8f7
Pipeline #963 passed with stage
in 1 minute and 59 seconds
......@@ -793,7 +793,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])) {
......
......@@ -1275,8 +1275,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) {
......
......@@ -116,15 +116,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