[gimp] plug-ins: Do not write to Iptc.Application2.DateCreated if no date was set.



commit 0a902456acff4efebd6f9ed555542fbb81691066
Author: Jacob Boerema <jgboerema gmail com>
Date:   Tue Mar 23 15:23:16 2021 -0400

    plug-ins: Do not write to Iptc.Application2.DateCreated if no date was set.
    
    The metadata-editor allowed Iptc tags to be set if an empty string was
    used contrary to Xmp tags. In the case of DateCreated this cause an
    invalid date "0-00-00" to be written.
    
    We added a check to only write text Iptc metadata if the value is
    not empty.

 plug-ins/metadata/metadata-editor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index 6c00078717..d34d9ca7fb 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -4181,7 +4181,8 @@ metadata_editor_write_callback (GtkWidget  *dialog,
                 {
                   gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata),
                                              equivalent_metadata_tags[index].tag);
-                  if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata),
+                  if (*text_value &&
+                      ! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata),
                                                         equivalent_metadata_tags[index].tag,
                                                         text_value))
                     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]