plug-ins: fix #6258 Hierarchical XMP tag should be written to Array
When saving XMP metadata were using gexiv2_metadata_get_tag_string for all
tags, even those that can have multiple values. This caused those values
to be saved as one value instead of multiple.
To fix this we use gexiv2_metadata_get_tag_multiple, except for XmpText.
Then we add all returned values for that tag separately to our metadata.
(cherry picked from commit af888e481f
)
This commit is contained in:
@ -823,14 +823,39 @@ gimp_metadata_serialize (GimpMetadata *metadata)
|
||||
{
|
||||
for (i = 0; xmp_data[i] != NULL; i++)
|
||||
{
|
||||
value = gexiv2_metadata_get_tag_string (GEXIV2_METADATA (metadata),
|
||||
xmp_data[i]);
|
||||
escaped = gimp_metadata_escape (xmp_data[i], value, &base64);
|
||||
g_free (value);
|
||||
/* XmpText is always a single value, but structures like
|
||||
* XmpBag and XmpSeq can have multiple values that need to be
|
||||
* treated separately or else saving will do things wrong. */
|
||||
if (! g_strcmp0 (gexiv2_metadata_get_tag_type (xmp_data[i]), "XmpText"))
|
||||
{
|
||||
value = gexiv2_metadata_get_tag_string (GEXIV2_METADATA (metadata),
|
||||
xmp_data[i]);
|
||||
escaped = gimp_metadata_escape (xmp_data[i], value, &base64);
|
||||
g_free (value);
|
||||
|
||||
gimp_metadata_append_tag (string, xmp_data[i], escaped, base64);
|
||||
gimp_metadata_append_tag (string, xmp_data[i], escaped, base64);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar **values;
|
||||
|
||||
values = gexiv2_metadata_get_tag_multiple (GEXIV2_METADATA (metadata),
|
||||
xmp_data[i]);
|
||||
|
||||
if (values)
|
||||
{
|
||||
gint vi;
|
||||
|
||||
for (vi = 0; values[vi] != NULL; vi++)
|
||||
{
|
||||
escaped = gimp_metadata_escape (xmp_data[i], values[vi], &base64);
|
||||
gimp_metadata_append_tag (string, xmp_data[i], escaped, base64);
|
||||
}
|
||||
|
||||
g_strfreev (values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (xmp_data);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user