1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Desktop: OneNote importer: Don't stop the import process if a style object can't be found (#13719)

This commit is contained in:
Henry Heino
2025-11-18 13:40:49 -08:00
committed by GitHub
parent 57a4a687d1
commit 907da6caa9

View File

@@ -385,12 +385,18 @@ pub(crate) fn parse_rich_text(content_id: ExGuid, space: ObjectSpaceRef) -> Resu
let styles_data: Vec<paragraph_style_object::Data> = data
.text_run_formatting
.iter()
.map(|style_id| {
.filter_map(|style_id| {
space
.get_object(*style_id)
.ok_or_else(|| ErrorKind::MalformedOneNoteData("styling is missing".into()).into())
.or_else(|| {
// Handle the case where styles are missing gracefully. It seems that style objects
// are sometimes missing, or can't be found:
// https://discourse.joplinapp.org/t/onenote-zip-file-import-not-working/47499/12
log_warn!("Paragraph styling not found: Unable to locate object with ID {:?}.", style_id);
None
})
})
.map(|style_object| style_object.and_then(|object| paragraph_style_object::parse(&object)))
.map(|style_object| paragraph_style_object::parse(&style_object))
.collect::<Result<Vec<_>>>()?;
// Parse the embedded objects