Verified Commit 534e4dab authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

Avoid using stored binary for conversion, always copy to temp file with original name

parent 7aab5292
Pipeline #6997 canceled with stages
......@@ -672,10 +672,7 @@ class digitalResource
}
$handler = $digitalResource->getHandler();
$metadata = stream_get_meta_data($handler);
if ($metadata['wrapper_type'] == 'plainfile') {
$srcfile = $metadata['uri'];
} else {
$tempdir = str_replace("/", DIRECTORY_SEPARATOR, \laabs\tempdir());
if (isset($digitalResource->fileName)) {
......@@ -686,9 +683,8 @@ class digitalResource
$tgtfp = fopen($srcfile, 'w');
stream_copy_to_stream($handler, $tgtfp);
rewind ($handler);
rewind($handler);
fclose($tgtfp);
}
$conversionRule = $this->sdoFactory->read("digitalResource/conversionRule", array('puid' => $digitalResource->puid));
......@@ -696,10 +692,7 @@ class digitalResource
$tgtfile = $converter->convert($srcfile, $outputFormats[$conversionRule->targetPuid]);
// Is tempdir was set, delete temp file
if (isset($tempdir)) {
unlink($srcfile);
}
if (!file_exists($tgtfile)) {
return false;
......
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