Skip to content

Commit f82f641

Browse files
refactor: reuse shared metadata normalizer in envelope assembler
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent dd723c6 commit f82f641

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

lib/Service/File/EnvelopeAssembler.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ public function buildEnvelopeChildData(File $childFile, \OCA\Libresign\Service\F
4747
$fileData->totalPages = (int)($childMetadata['p'] ?? 0);
4848
$fileData->pdfVersion = (string)($childMetadata['pdfVersion'] ?? '');
4949

50-
$childMetadata['p'] = $fileData->totalPages;
51-
$extension = pathinfo($childFile->getName(), PATHINFO_EXTENSION);
52-
if (!isset($childMetadata['extension']) || !is_string($childMetadata['extension']) || trim($childMetadata['extension']) === '') {
53-
$childMetadata['extension'] = is_string($extension) && $extension !== '' ? strtolower($extension) : 'pdf';
54-
}
50+
$childMetadata = ValidationMetadataNormalizer::normalize($childMetadata, $childFile->getName(), $fileData->totalPages);
5551
$fileData->metadata = $childMetadata;
5652

5753
$nodeId = $childFile->getSignedNodeId() ?: $childFile->getNodeId();

0 commit comments

Comments
 (0)