-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Describe the bug
apple_cloud_notes_parser can't copy Media, FallbackPDFs. It can only copy Previews.
To Reproduce
Just run ruby notes_cloud_ripper.rb -m "/Users/user/Library/Group Containers/group.com.apple.notes/"
Expected behavior
I have pdfs, images in notes so it should copy it to output directory.
Screenshots
D, [2024-12-30T13:57:06.212727 #31694] DEBUG -- : Note 45: Created a new Embedded Object of type com.apple.paper.doc.pdf
D, [2024-12-30T13:57:06.212786 #31694] DEBUG -- : Checking if Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media// exists as a real file on disk
D, [2024-12-30T13:57:06.212815 #31694] DEBUG -- : Found Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media//! Creating a new AppleStoredFileResult
D, [2024-12-30T13:57:06.212873 #31694] DEBUG -- : Copying /Users/user/Library/Group Containers/group.com.apple.notes/Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media// to ./output/2024_12_30-13_57_06/files/Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media
E, [2024-12-30T13:57:06.212989 #31694] ERROR -- : Failed to copy /Users/user/Library/Group Containers/group.com.apple.notes/Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media// to ./output/2024_12_30-13_57_06/files/Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media
...
D, [2024-12-30T13:57:06.221645 #31694] DEBUG -- : Note 73: Created a new Embedded Object of type com.adobe.pdf
D, [2024-12-30T13:57:06.221720 #31694] DEBUG -- : Checking if Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media/D40EC9F7-CC7B-4D2D-90E2-709C10A90C20/2402.07596v2.pdf exists as a real file on disk
D, [2024-12-30T13:57:06.221778 #31694] DEBUG -- : Found Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media/D40EC9F7-CC7B-4D2D-90E2-709C10A90C20/2402.07596v2.pdf! Creating a new AppleStoredFileResult
E, [2024-12-30T13:57:06.221919 #31694] ERROR -- : AppleNoteStore: NoteStore tried to rip Note 73 but had to rescue error: File exists @ dir_s_mkdir - ./output/2024_12_30-13_57_06/files/Accounts/488ED16B-1168-44DB-A8D0-464031965FAF/Media
E, [2024-12-30T13:57:06.221933 #31694] ERROR -- : Backtrace: /opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:403:in 'Dir.mkdir'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:403:in 'FileUtils.fu_mkdir'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:381:in 'block (2 levels) in FileUtils#mkdir_p'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:379:in 'Array#reverse_each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:379:in 'block in FileUtils#mkdir_p'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:371:in 'Array#each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/fileutils-1.7.3/lib/fileutils.rb:371:in 'FileUtils#mkdir_p'
/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/pathname.rb:590:in 'Pathname#mkpath'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleBackup.rb:238:in 'AppleBackup#back_up_file'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedPDF.rb:38:in 'AppleNotesEmbeddedPDF#initialize'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedObject.rb:544:in 'Class#new'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedObject.rb:544:in 'block (2 levels) in AppleNotesEmbeddedObject.generate_embedded_objects'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:254:in 'block (2 levels) in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/resultset.rb:50:in 'SQLite3::ResultSet#each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:253:in 'block in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:220:in 'SQLite3::Database#prepare'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:248:in 'SQLite3::Database#execute'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedObject.rb:442:in 'block in AppleNotesEmbeddedObject.generate_embedded_objects'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedObject.rb:422:in 'Google::Protobuf::RepeatedField#each'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNotesEmbeddedObject.rb:422:in 'AppleNotesEmbeddedObject.generate_embedded_objects'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNote.rb:207:in 'AppleNote#replace_embedded_objects'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNote.rb:163:in 'AppleNote#process_note'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNoteStore.rb:915:in 'block in AppleNoteStore#rip_note'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:254:in 'block (2 levels) in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/resultset.rb:50:in 'SQLite3::ResultSet#each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:253:in 'block in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:220:in 'SQLite3::Database#prepare'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:248:in 'SQLite3::Database#execute'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNoteStore.rb:805:in 'AppleNoteStore#rip_note'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNoteStore.rb:686:in 'block in AppleNoteStore#rip_notes'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:254:in 'block (2 levels) in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/resultset.rb:50:in 'SQLite3::ResultSet#each'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:253:in 'block in SQLite3::Database#execute'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:220:in 'SQLite3::Database#prepare'
/opt/homebrew/lib/ruby/gems/3.4.0/gems/sqlite3-2.5.0-arm64-darwin/lib/sqlite3/database.rb:248:in 'SQLite3::Database#execute'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNoteStore.rb:684:in 'AppleNoteStore#rip_notes'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleNoteStore.rb:227:in 'AppleNoteStore#rip_all_objects'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleBackup.rb:315:in 'block in AppleBackup#rip_notes'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleBackup.rb:312:in 'Array#each'
/Users/user/practice/apple_cloud_notes_parser/lib/AppleBackup.rb:312:in 'AppleBackup#rip_notes'
notes_cloud_ripper.rb:209:in '<main>'
First pdf is uploaded on iPhone. We can see wrong directory like // on debug log. There might be wrong null check or recent iOS/macOS Notes bring some breaking compatibility on SQLite.
Second pdf is uploaded on Macbook. In this case apple_cloud_notes_parser located pdf directory correctly but it still produce error. It means apple_cloud_notes_parser can locate/parse pdf but there are some bugs.
I only provided pdfs related logs, but same error happens on images also.
Desktop (please complete the following information):
- OS: Macbook
- Version Ventura 13.3
- Ruby Version 3.4.1
Smartphone Source (please complete the following information, if applicable):
- Device: iPhone XS
- OS: iOS 18.1.1
- Type of backup: I didn't trigger backup on iOS, but uploaded notes/pdfs.
Command used
ruby notes_cloud_ripper.rb -m "/Users/user/Library/Group Containers/group.com.apple.notes/"
Please confirm the following
- Error occurs on the latest version of this program on GitHub [Y/N] Y
- You have run
bundle install[Y/N] Y
Additional context