summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e4b8330)
Metadata can now only be string or null.
Fixes #1653
protected function buildFormData(array $link, bool $isNew, Request $request): array
{
protected function buildFormData(array $link, bool $isNew, Request $request): array
{
- $link['tags'] = strlen($link['tags']) > 0
+ $link['tags'] = $link['tags'] !== null && strlen($link['tags']) > 0
? $link['tags'] . $this->container->conf->get('general.tags_separator', ' ')
: $link['tags']
;
? $link['tags'] . $this->container->conf->get('general.tags_separator', ' ')
: $link['tags']
;
$title = mb_convert_encoding($title, 'utf-8', $charset);
}
$title = mb_convert_encoding($title, 'utf-8', $charset);
}
+ return array_map([$this, 'cleanMetadata'], [
'title' => $title,
'description' => $description,
'tags' => $tags,
'title' => $title,
'description' => $description,
'tags' => $tags,
+ ]);
+ }
+
+ protected function cleanMetadata($data): ?string
+ {
+ return !is_string($data) || empty(trim($data)) ? null : trim($data);
$remoteCharset = 'utf-8';
$expectedResult = [
$remoteCharset = 'utf-8';
$expectedResult = [
- 'title' => $remoteTitle,
+ 'title' => trim($remoteTitle),
'description' => $remoteDesc,
'tags' => $remoteTags,
];
'description' => $remoteDesc,
'tags' => $remoteTags,
];