Skip to content

Bunch of bug fixes#24

Open
sai3563 wants to merge 1 commit intostorizzi:mainfrom
sai3563:main
Open

Bunch of bug fixes#24
sai3563 wants to merge 1 commit intostorizzi:mainfrom
sai3563:main

Conversation

@sai3563
Copy link
Copy Markdown

@sai3563 sai3563 commented Mar 22, 2026

Hello,

I work in an org where iCloud drive is not allowed but Google Drive via Google Workspace is, so I resorted to using this project to backup my Apple Notes.

After I set it up, while testing I believe to have come across a multitude of bugs & I've implemented fixes that I've also tested on my machine. Those are as follows:

Bug 1:

  # Before
  SCRIPT_DIR=$(dirname $(realpath "$0"))
  # After
  SCRIPT_DIR="$(dirname "$(realpath "$0")")"

If the notes-exporter project is in a path with spaces, e.g. /Users/me/My Programs/notes-exporter, then the original code fails due to $(realpath "$0") being unquoted. Fixed by adding quotes.

Bug 2:

  -- Before
  write content to fileDescriptor starting at eof as «class utf8»
  -- After
  set eof fileDescriptor to 0
  write content to fileDescriptor starting at 0 as «class utf8»

When I ran it multiple times with --update-all, I saw that instead of overwriting, it was appending to the existing notes leading to the size increasing in multiples of each run. Thus is because starting at eof appends to the existing file. Fixed by truncating the file before writing.

Bug 3:

  # Before
  formats = [
      "%A, %B %d, %Y at %I:%M:%S %p",
      "%A, %d %B %Y at %H:%M:%S",
  ]
  # After
  formats = [
      "%A, %B %d, %Y at %I:%M:%S %p",    # 12-hour, month before day
      "%A, %d %B %Y at %I:%M:%S %p",     # 12-hour, day before month
      "%A, %d %B %Y at %H:%M:%S",        # 24-hour, day before month
      "%A, %B %d, %Y at %H:%M:%S",       # 24-hour, month before day
  ]

In my Indian locale, the date parsing done by set-file-dates was failing. Apple Notes returns dates like Saturday, 21 March 2026 at 7:45:55 PM on systems with day-before-month locale settings. The existing formats only handled month-before-day (12h) and day-before-month (24h), missing the 12-hour day-before-month and 24-hour month-before-day combinations. All four combinations are now covered.

CC : @storizzi

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.

1 participant