Verified Commit a1e10b9b authored by Alexandre Morin's avatar Alexandre Morin
Browse files

fix (13451) : unzip filename after validate digital resource

parent 2abaaea8
Pipeline #7200 canceled with stages
...@@ -403,6 +403,7 @@ trait archiveValidationTrait ...@@ -403,6 +403,7 @@ trait archiveValidationTrait
$digitalResource->size = filesize($filename); $digitalResource->size = filesize($filename);
if ($digitalResource->size == 0) { if ($digitalResource->size == 0) {
unlink($filename);
throw new \bundle\recordsManagement\Exception\invalidArchiveException('Resource size is null', 400); throw new \bundle\recordsManagement\Exception\invalidArchiveException('Resource size is null', 400);
} }
...@@ -425,8 +426,10 @@ trait archiveValidationTrait ...@@ -425,8 +426,10 @@ trait archiveValidationTrait
if ($formatValidation) { if ($formatValidation) {
$validation = $this->formatController->validateFormat($filename); $validation = $this->formatController->validateFormat($filename);
if (!$validation !== true && is_array($validation)) { if (!$validation !== true && is_array($validation)) {
unlink($filename);
throw new \core\Exception\BadRequestException("Invalid format attachments for %s", 404, null, [$digitalResource->fileName]); throw new \core\Exception\BadRequestException("Invalid format attachments for %s", 404, null, [$digitalResource->fileName]);
} }
} }
unlink($filename);
} }
} }
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