Skip to content

Commit 0a1fa49

Browse files
Merge pull request #1999 from jim-easterbrook/bug_1998
Restore modified tags after TZ manipulation
2 parents 889e1c6 + 2e2dd88 commit 0a1fa49

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

src/xmpsidecar.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ namespace Exiv2 {
144144
copyExifToXmp(exifData_, xmpData_);
145145
copyIptcToXmp(iptcData_, xmpData_);
146146

147-
// #589 - restore tags which were modified by the convertors
148-
for (auto&& it : copy) {
149-
xmpData_[it.key()] = it.value();
150-
}
151-
152147
// #1112 - restore dates if they lost their TZ info
153148
for (auto&& date : dates_) {
154149
std::string sKey = date.first;
@@ -163,6 +158,11 @@ namespace Exiv2 {
163158
}
164159
}
165160

161+
// #589 - restore tags which were modified by the convertors
162+
for (auto&& it : copy) {
163+
xmpData_[it.key()] = it.value();
164+
}
165+
166166
if (XmpParser::encode(xmpPacket_, xmpData_,
167167
XmpParser::omitPacketWrapper|XmpParser::useCompactFormat) > 1) {
168168
#ifndef SUPPRESS_WARNINGS

test/data/issue_1998.xmp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
2+
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
3+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4+
<rdf:Description rdf:about=""
5+
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
6+
xmp:CreateDate="2021-02-03T12:34:56+02:00"/>
7+
</rdf:RDF>
8+
</x:xmpmeta>
9+
<?xpacket end="w"?>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import system_tests
4+
from system_tests import CaseMeta, path
5+
6+
class TestXmpDateTimeSetting(metaclass=CaseMeta):
7+
"""
8+
Test fix for issue 1998.
9+
"""
10+
11+
infile = path("$data_path/issue_1998.xmp")
12+
commands = [
13+
"$exiv2 -M\"set Xmp.xmp.CreateDate XmpText 2021-02-03T12:00:00+01:00\" $infile",
14+
"$exiv2 -K Xmp.xmp.CreateDate $infile",
15+
"$exiv2 -M\"set Xmp.xmp.CreateDate XmpText 2021-02-03T12:34:56+02:00\" $infile",
16+
"$exiv2 -K Xmp.xmp.CreateDate $infile",
17+
]
18+
stdout = [
19+
"",
20+
"""Xmp.xmp.CreateDate XmpText 25 2021-02-03T12:00:00+01:00
21+
""",
22+
"",
23+
"""Xmp.xmp.CreateDate XmpText 25 2021-02-03T12:34:56+02:00
24+
""",
25+
]
26+
stderr = [""]*4
27+
retval = [0]*4
28+

0 commit comments

Comments
 (0)