-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
Description
Describe the bug
- Getting exceptions with four different NoteStore files.
- Debug logs do not seem to contain any relevant information about the exceptions.
- Nothing is initially output since processing is aborted.
- Adding dumb rescue statements (below) makes output finish (unsure if incomplete)
What more information (short of the files) can be provided to resolve the issues?
EXCEPTION 1 (No call stack)
SQLite3::CorruptException encountered while trying to write plaintext to database, this may be a result of a Notes migration, try opening the application and saving it again.
EXCEPTION 2
Guessed Notes Version: 16
./apple_cloud_notes_parser/lib/AppleNote.rb:332:in `inflate': invalid stored block lengths (Zlib::DataError)
EXCEPTION 3
Guessed Notes Version: 17
/opt/homebrew/lib/ruby/gems/3.3.0/gems/sqlite3-1.7.3-arm64-darwin/lib/sqlite3/resultset.rb:162:in `step': database disk image is malformed (SQLite3::CorruptException)
from ./apple_cloud_notes_parser/lib/AppleNoteStore.rb:678:in `rip_notes'
EXCEPTION 4 (Same as 2, but different notes version)
Guessed Notes Version: 17
./apple_cloud_notes_parser/lib/AppleNote.rb:332:in `inflate': incorrect data check (Zlib::DataError)
Expected behavior
No crashes, obviously.
Desktop (please complete the following information):
- macOS Sonoma
- Ruby 3.3
- Git 14646d8
Command used
ruby notes_cloud_parser.rb -f NoteStore.sqlite
Please confirm the following
- Error occurs on the latest version of this program on GitHub: Yes
- You have run
bundle install: Yes
Additional context
Workaround:
diff --git a/lib/AppleNote.rb b/lib/AppleNote.rb
index 051616b..c318e97 100644
--- a/lib/AppleNote.rb
+++ b/lib/AppleNote.rb
@@ -332 +332,5 @@ class AppleNote < AppleCloudKitRecord
- @decompressed_data = zlib_inflater.inflate(@compressed_data)
+ begin
+ @decompressed_data = zlib_inflater.inflate(@compressed_data)
+ rescue StandardError => e
+ warn "\033[101m#{e}\033[m"
+ end
diff --git a/lib/AppleNoteStore.rb b/lib/AppleNoteStore.rb
index ff17399..eb54919 100644
--- a/lib/AppleNoteStore.rb
+++ b/lib/AppleNoteStore.rb
@@ -678,3 +678,7 @@ class AppleNoteStore
- @database.execute(tmp_query, range_start_core, range_end_core) do |row|
- self.rip_note(row["ZNOTE"])
- end
+ @database.execute(tmp_query, range_start_core, range_end_core) do |row|
+ begin
+ self.rip_note(row["ZNOTE"])
+ rescue StandardError => e
+ warn "\033[101m#{e}\033[m"
+ end
+ end