Skip to content

Commit 28d5bd6

Browse files
committed
It works?
1 parent 64f89ca commit 28d5bd6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/jpeg.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,22 @@ impl JPEGReader {
190190
let tag_key = format!("{}:{}", record, dataset);
191191
let (_, repeatable, parse_fn) = tags_map.get(tag_key).unwrap_or(NULL_BLOCK);
192192

193-
// Write each value as a separate entry for repeatable fields
194-
for value in values {
193+
// For non-repeatable fields, only use the first value
194+
let values_to_write = if repeatable {
195+
values
196+
} else {
197+
// Take just the first value for non-repeatable fields
198+
if values.len() > 1 {
199+
println!(
200+
"Warning: Multiple values provided for non-repeatable field {:?}, using only the first value",
201+
tag
202+
);
203+
}
204+
&values[..1]
205+
};
206+
207+
// Write each value as a separate entry
208+
for value in values_to_write {
195209
// Field delimiter
196210
iptc_block.push(0x1C);
197211

0 commit comments

Comments
 (0)