Add length checks to prevent attempting to insert pages after end of document#70
Conversation
69d4287 to
0703bf8
Compare
|
Also added a fix for supporting a deleted inserted page |
|
Added a fix for weird edge case where an rm file exists on disk, but is not part of the 'pages' list in xochitl |
Is the file that causes this error something you can add to tests? Given the wide scope of strange issues with PDFs and edge cases with .rm files I am very strict on testing. Every change in remarks should be accompanied by a test file or test case. |
b3108c1 to
1c9dbe8
Compare
|
Added a test. I'm using remarks in a kind of weird way (as a library in my own syncing solution), so I may be running into issues that won't happen in normal usage of remarks. |
I don't know what "normal" usage of remarks means to be honest, it's meant to be a reliable tool and library to process .rmdoc files. That's about it. |
|
It looks all good, want to merge it but one tiny thing is that the test file's name overlaps with another test file's name so output. You can open the zip and edit the file metadata's |
1c9dbe8 to
253a807
Compare
|
The force push includes #16. If it's just the name, then it's ready to merge. |
…document, and stop inserting deleted inserted pages
…y, but is not in page list
253a807 to
c804670
Compare
|
Oops, fixed now. this branch should just have the relevant commits rebased on top of main now. |

I have a strange notebook (originally ePub), that causes remarks to crash while trying to process it. Specifically it falls over at this line:
remarks/remarks/Document.py
Line 49 in 9a6673d
As it tries to insert a page far after the source pdf has ended. I am unsure why the underlying notebook is like this - maybe something when wrong in Remarkable's ePub to pdf conversion?
I added a small fix here that makes sure that new pages are only added at the end of the pdf, this seems to fix it.
As it the notebook causing this issue is a purchased ePub I'm hesitant to share it publicly but happy to DM it to you for testing if you require.