WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@personalizedrefrigerator
Copy link
Collaborator

Summary

This pull fixes an issue where Joplin imported old versions of notes exported from the OneNote desktop app. Previously, when an export file contained multiple revisions, Joplin would import content from the older revision.

May fix #13844.

Testing

This pull request adds a new automated test file that includes a note with two revisions. Prior to this pull request, the first (old) revision was imported. With this change, the second (new) revision is imported.

Comment on lines +97 to +102
// TODO: It would make more sense to use the **last** revision, rather than
// the first to get the content root. However, doing so seems to return
// version history information, rather than the true content root.
// In the future, if there are issues related to importing the wrong versions
// of pages, look into this.
// .rev()
Copy link
Collaborator Author

@personalizedrefrigerator personalizedrefrigerator Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this call to .rev() is left uncommented, the page-parsing logic fails with an "unexpected object type" error, where the object was expected to be of type PageMetadata, but was VersionHistoryMetadata.

The "TODO" comment has been added because, logically, it seems as though the content root should be determined by the last revision, which should have the most up-to-date data.

let mut last_index = iterator.get_index();
while let Some(current) = iterator.peek() {
if let FileNodeData::RevisionManifestEndFND = current {
iterator.next();
Copy link
Collaborator Author

@personalizedrefrigerator personalizedrefrigerator Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this iterator.next(), the RevisionManifestList parser sees the RevisionManifestEndFND and only parses one revision. As a result, the imported revision lists only contained one revision and second/third/fourth/etc. revisions were ignored.

For context, the RevisionManifestList parser runs the Revision parser to build a list of revisions.

@laurent22 laurent22 merged commit b40c2b8 into laurent22:dev Dec 8, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OneNote importer imports the wrong revision (importing a file exported from the OneNote desktop app)

2 participants