diff --git a/app/actions.cpp b/app/actions.cpp index 5e933af780..e7f28646e5 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -1718,7 +1718,7 @@ int metacopy(const std::string& source, const std::string& tgt, Exiv2::ImageType std::string target(bStdout ? temporaryPath() : tgt); std::unique_ptr targetImage; - if (Exiv2::fileExists(target)) { + if (preserve && Exiv2::fileExists(target)) { targetImage = Exiv2::ImageFactory::open(target); targetImage->readMetadata(); } else { diff --git a/test/data/pr_2425_poc1.jpg b/test/data/pr_2425_poc1.jpg new file mode 100644 index 0000000000..19a28882a9 Binary files /dev/null and b/test/data/pr_2425_poc1.jpg differ diff --git a/tests/bugfixes/github/test_pr_2425.py b/tests/bugfixes/github/test_pr_2425.py new file mode 100644 index 0000000000..17d2514f0b --- /dev/null +++ b/tests/bugfixes/github/test_pr_2425.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from system_tests import CaseMeta, CopyTmpFiles, path + +@CopyTmpFiles("$data_path/pr_2425_poc1.jpg") +class testExiv2AppExtractOverrideFile(metaclass=CaseMeta): + url = "https://github.com/Exiv2/exiv2/issues/2425" + description = "Fix bug 1. reported in https://github.com/Exiv2/exiv2/issues/1934" + + filename_jpg = "$tmp_path/pr_2425_poc1.jpg" + filename_exv = "$tmp_path/pr_2425_poc1.exv" + + commands = ["$exiv2 --force --extract XXeix $filename_jpg", + "$exiv2 --print a $filename_exv", + "$exiv2 --force --extract XXex $filename_jpg", + "$exiv2 --print a $filename_exv"] + + retval = [0]*4 + stderr = [""]*4 + stdout = ["""""", + """Exif.Image.ImageDescription Ascii 11 Test image +Iptc.Application2.Subject String 12 Test subject +Xmp.dc.subject XmpBag 1 Test subject +""", + """""", + """Exif.Image.ImageDescription Ascii 11 Test image +Xmp.dc.subject XmpBag 1 Test subject +"""] diff --git a/tests/bugfixes/redmine/test_issue_751.py b/tests/bugfixes/redmine/test_issue_751.py index f2366cbcbd..398602d4e0 100644 --- a/tests/bugfixes/redmine/test_issue_751.py +++ b/tests/bugfixes/redmine/test_issue_751.py @@ -66,7 +66,6 @@ def read_xmpfile(): "", """Warning: Updating namespace URI for imageapp from orig/ to dest/ """, - """Warning: Updating namespace URI for imageapp from dest/ to orig/ -""", + """""", ] retval = [0] * 4 diff --git a/tests/regression_tests/test_regression_allfiles.py b/tests/regression_tests/test_regression_allfiles.py index 25ba4c0e86..75c06e44c6 100644 --- a/tests/regression_tests/test_regression_allfiles.py +++ b/tests/regression_tests/test_regression_allfiles.py @@ -148,6 +148,7 @@ def get_valid_files(data_dir): # different output let's try and fix this later "exiv2-bug1044.tif", "issue_2403_poc.exv", + "pr_2425_poc1.jpg", ] file_paths = [