Commit 271a62c9 authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

Merge branch 'hotfix/8280-HashWhenNoIntegrityInSIP' into 'master'

Calc hash of binary contents if no <Integrity> in SEDA SIP

See merge request maarch/archivesPubliques!42
parents cf165418 5d6ad093
......@@ -810,15 +810,20 @@ class ArchiveTransfer extends abstractMessage
$content->resId = $resource->resId;
$binary = $resource->getContents();
if (isset($sedaDocument->integrity)) {
$resource->hash = (string) $sedaDocument->integrity->value;
$resource->hashAlgorithm = substr($sedaDocument->integrity->algorithme, strrpos($sedaDocument->integrity->algorithme, "#")+1);
} else {
$resource->hash = hash('SHA256', $binary);
$resource->hashAlgorithm = 'SHA256';
}
if (isset($sedaDocument->size)) {
$resource->size = (string) $sedaDocument->size->value;
} else {
$resource->size = strlen($resource->getContents());
$resource->size = strlen($binary);
}
$archive->digitalResources[] = $resource;
......
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