Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
fe43bedd
Verified
Commit
fe43bedd
authored
Feb 26, 2020
by
Cyril Vazquez
Browse files
Get size from temp file
parent
b7ce00ee
Pipeline
#7038
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bundle/recordsManagement/Controller/archiveValidationTrait.php
View file @
fe43bedd
...
...
@@ -392,10 +392,6 @@ trait archiveValidationTrait
*/
public
function
validateDigitalResource
(
$digitalResource
)
{
if
(
$digitalResource
->
size
==
0
)
{
throw
new
\
bundle\recordsManagement\Exception\invalidArchiveException
(
'Resource size is null'
,
400
);
}
// Create temp file
$handler
=
$digitalResource
->
getHandler
();
$filename
=
tempnam
(
sys_get_temp_dir
(),
'digitalResource.format'
);
...
...
@@ -406,6 +402,10 @@ trait archiveValidationTrait
$digitalResource
->
size
=
filesize
(
$filename
);
if
(
$digitalResource
->
size
==
0
)
{
throw
new
\
bundle\recordsManagement\Exception\invalidArchiveException
(
'Resource size is null'
,
400
);
}
if
(
!
isset
(
$digitalResource
->
mimetype
))
{
$finfo
=
new
\
finfo
();
$mimetype
=
$finfo
->
file
(
$filename
,
FILEINFO_MIME_TYPE
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment