fixes #2093 handle new lines on metadata sync

This commit is contained in:
plegall
2024-01-29 19:27:47 +01:00
parent e59b5282d5
commit 4ea2996969

View File

@@ -233,6 +233,17 @@ function get_sync_metadata($infos)
$infos = array_merge($infos, $iptc);
}
foreach (array('name', 'author') as $single_line_field)
{
if (isset($infos[$single_line_field]))
{
foreach (array("\r\n", "\n") as $to_replace_string)
{
$infos[$single_line_field] = str_replace($to_replace_string, ' ', $infos[$single_line_field]);
}
}
}
return $infos;
}
@@ -393,6 +404,8 @@ function metadata_normalize_keywords_string($keywords_string)
global $conf;
$keywords_string = preg_replace($conf['metadata_keyword_separator_regex'], ',', $keywords_string);
// new lines are always considered as keyword separators
$keywords_string = str_replace(array("\r\n", "\n"), ',', $keywords_string);
$keywords_string = preg_replace('/,+/', ',', $keywords_string);
$keywords_string = preg_replace('/^,+|,+$/', '', $keywords_string);