Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Apple Notes] All attachments become "**error reading attachment**" after import #148

Closed
dinghaoz opened this issue Oct 21, 2023 · 7 comments · Fixed by #146
Closed

[Apple Notes] All attachments become "**error reading attachment**" after import #148

dinghaoz opened this issue Oct 21, 2023 · 7 comments · Fixed by #146
Labels
apple notes bug Something isn't working

Comments

@dinghaoz
Copy link

I am on macOS 14.0 (23A344). Zero attachments are actually imported.

@mirnovov
Copy link
Contributor

mirnovov commented Oct 21, 2023

@dinghaoz This is because the importer is having trouble reading the data where your attachments are stored. Unfortunately, without more information I can't tell what exactly the cause of this is.

  • Do you use 'On My Mac' instead of storing your Apple Notes in iCloud?
  • Are any of the notes you've trying to import shared with other people, or by other people?
  • Your files should be stored in /Users/yourusername/Library/Group Containers/group.com.apple.notes/Accounts/bunchofrandomnumbers/Media/. Are there images in the subfolders there?
  • Do the image subfolders and account folders follow a format that looks like this: 2B93D0B5-DC59-4595-B6BB-17DB7FE3DEAD?
  • Does your user folder have any special characters or is otherwise unusual?
  • Have you opened Apple Notes since upgrading to Sonoma?

@dinghaoz
Copy link
Author

dinghaoz commented Oct 21, 2023

Thanks for the reply. Here are the answers:

  1. I store my Apple Notes in iCloud.
  2. Yes, I do share a few notes with my wife, but not all.
  3. No, /Users/yourusername/Library/Group Containers/group.com.apple.notes/Accounts/bunchofrandomnumbers/ doesn't have Media folder. But /Users/yourusername/Library/Group Containers/group.com.apple.notes/Media exists though and it seems like it is where all the attachments located.
  4. Yes, they do.
  5. Yes, I prefix my notes folder with emojis to make them look more like Notion and my notes' titles are mostly in Chinese.
  6. Yes I have.
    @mirnovov

@dinghaoz
Copy link
Author

dinghaoz commented Oct 21, 2023

@mirnovov
I feel that the issue might be related to question 3. The code seems assuming the attachments are under group.com.apple.notes/Accounts/account-UUID/Media but they are actually at group.com.apple.notes/Media. Could that be a new thing on Sonoma? I don't have older version of Mac so can't be sure.

The code: apple-notes.ts:331

				const account = row.ZACCOUNT6 || row.ZACCOUNT5;
				sourcePath = path.join(
					this.resolvedAccounts[account].path, 
					'Media', row.ZIDENTIFIER, row.ZGENERATION1 || '', row.ZFILENAME
				);

But my folder hierarchy looks like this
Screenshot 2023-10-21 at 23 27 00

@mirnovov
Copy link
Contributor

mirnovov commented Oct 21, 2023

Yeah, I think this is it. Thanks for the help.

It’s not to do with the macOS version I think, I’m on Sonoma (and have tested on a bunch of other versions) and everything is under the Accounts folder for me, and this seems to be the case for the vast majority of people on all versions. Worst case scenario if I can’t figure out I can always just have it check both the first time to determine which one to use.

@kepano
Copy link
Collaborator

kepano commented Oct 21, 2023

@mirnovov there may be some useful prior art in Apple Notes Liberator to find the location of the database

@mirnovov
Copy link
Contributor

mirnovov commented Oct 21, 2023

Unfortunately there isn’t, it assumes the files are always in the same folder like this importer currently does.

@ericaxu ericaxu added bug Something isn't working apple notes labels Oct 23, 2023
@kepano
Copy link
Collaborator

kepano commented Oct 24, 2023

This should now be fixed if you update to Importer 1.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple notes bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants