X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fhttp%2FMetadataRetriever.php;h=cfc72583e713a192f08199554388990d0d508f8b;hb=6a3a78d023aa320138bb88505b58347db268264a;hp=2e1401eca74f0c9857d7d31c34934a14b6811066;hpb=e4b8330e459b598328bf250208386c06ec257b08;p=github%2Fshaarli%2FShaarli.git diff --git a/application/http/MetadataRetriever.php b/application/http/MetadataRetriever.php index 2e1401ec..cfc72583 100644 --- a/application/http/MetadataRetriever.php +++ b/application/http/MetadataRetriever.php @@ -60,10 +60,15 @@ class MetadataRetriever $title = mb_convert_encoding($title, 'utf-8', $charset); } - return [ + return array_map([$this, 'cleanMetadata'], [ 'title' => $title, 'description' => $description, 'tags' => $tags, - ]; + ]); + } + + protected function cleanMetadata($data): ?string + { + return !is_string($data) || empty(trim($data)) ? null : trim($data); } }