* fix bug issue393

* Fixed to compare binary data

* Change search criteria to compare ID with binary data
main
hayato-SMZ 2022-10-26 22:35:28 +09:00 committed by GitHub
parent b44c05e13c
commit 010613c909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -920,13 +920,20 @@ fn collect_images_from_paragraph(
for child in &mut run.children {
if let RunChild::Drawing(d) = child {
if let Some(DrawingData::Pic(pic)) = &mut d.data {
images.push((
pic.id.clone(),
// For now only png supported
format!("media/{}.png", pic.id),
));
let b = std::mem::take(&mut pic.image);
image_bufs.push((pic.id.clone(), b));
let buf = image_bufs
.iter()
.find(|x| x.0 == pic.id.clone() || x.1 == b.clone());
if buf.as_ref().is_none() {
images.push((
pic.id.clone(),
// For now only png supported
format!("media/{}.png", pic.id),
));
image_bufs.push((pic.id.clone(), b));
} else {
pic.id = buf.unwrap().0.clone();
}
}
}
}