trash/mac: list shows all items regardless of original path #9

Closed
opened 2026-03-20 20:49:13 +00:00 by barrettruth · 0 comments
barrettruth commented 2026-03-20 20:49:13 +00:00

Problem

The macOS trash adapter's `list` function returns every item in `~/.Trash` without filtering by original directory. The freedesktop and Windows adapters compare each item's `original_path` against the current URL to show only items that belonged there; the macOS adapter has no such logic.

Navigating to e.g. `canola-trash:///Users/user/projects/` shows all trashed items from every directory, not just those originally under `~/projects/`.

A `TODO` comment at line 81 of `lua/canola/adapters/trash/mac.lua` notes this explicitly.

Solution

Read macOS-specific metadata to recover the original path of each trashed item. Options include:

  • `mdls -name kMDItemWhereFroms` or `xattr -p com.apple.quarantine`
  • Parsing the `.DS_Store` file in `~/.Trash`
  • Using `swift`/`osascript` to query `FileManager`

The right approach likely mirrors how freedesktop reads `.trashinfo` files: iterate items in `~/.Trash`, recover their original path, and filter against the requested URL.

## Problem The macOS trash adapter's \`list\` function returns every item in \`~/.Trash\` without filtering by original directory. The freedesktop and Windows adapters compare each item's \`original_path\` against the current URL to show only items that belonged there; the macOS adapter has no such logic. Navigating to e.g. \`canola-trash:///Users/user/projects/\` shows all trashed items from every directory, not just those originally under \`~/projects/\`. A \`TODO\` comment at line 81 of \`lua/canola/adapters/trash/mac.lua\` notes this explicitly. ## Solution Read macOS-specific metadata to recover the original path of each trashed item. Options include: - \`mdls -name kMDItemWhereFroms\` or \`xattr -p com.apple.quarantine\` - Parsing the \`.DS_Store\` file in \`~/.Trash\` - Using \`swift\`/\`osascript\` to query \`FileManager\` The right approach likely mirrors how freedesktop reads \`.trashinfo\` files: iterate items in \`~/.Trash\`, recover their original path, and filter against the requested URL.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/canola-collection#9
No description provided.