fix: don't delete temp icon file before notification is enqueued#5
fix: don't delete temp icon file before notification is enqueued#5
Conversation
UNNotificationAttachment init only records the file path; the actual file move happens during center.add(). Removing the temp directory immediately after init deleted the file before it could be moved, causing "Failed to move attachment file into data store". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a macOS notification failure caused by deleting a temporary icon file/directory before the notification request is actually enqueued and the system has moved the attachment into its data store.
Changes:
- Remove the immediate temp-directory cleanup after
UNNotificationAttachmentinitialization increateIconAttachment. - Keep cleanup only on the error path to avoid breaking attachment moves during
UNUserNotificationCenter.add().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use a single reusable directory (sh.send.macnotifier) instead of per-notification UUID directories to avoid accumulation in /tmp. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Avoid race conditions between concurrent processes by using unique filenames, while cleaning up previous copies best-effort before creating new ones. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
removeItem(at: tmpDir)call increateIconAttachmentUNNotificationAttachmentinit only records the file path; the actual file move into the data store happens duringcenter.add(). Deleting the temp directory immediately after init caused "Failed to move attachment file into data store", which made the entire notification fail silently and left no process to handle clicks.Test plan
macnotifier -m "test" --icon ~/.claude/assets/claude-icon.png --sound Glass -a com.github.wez.weztermshows icon, plays sound, and activates WezTerm on click./scripts/test.shpasses (15/15)🤖 Generated with Claude Code