Issue393 (#552)
* fix bug issue393 * Fixed to compare binary data * Change search criteria to compare ID with binary datamain
parent
b44c05e13c
commit
010613c909
|
@ -920,13 +920,20 @@ fn collect_images_from_paragraph(
|
||||||
for child in &mut run.children {
|
for child in &mut run.children {
|
||||||
if let RunChild::Drawing(d) = child {
|
if let RunChild::Drawing(d) = child {
|
||||||
if let Some(DrawingData::Pic(pic)) = &mut d.data {
|
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);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue