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



commit 27ee0c87eebc463a5e8e33115989c9a835d3717e
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.
    
    (cherry picked from commit 0a902456acff4efebd6f9ed555542fbb81691066)

 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 e4f241ae5d..bc786ae9a6 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -4173,7 +4173,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]