proog / obsidian-trash-explorer

Restore and delete files from the Obsidian .trash folder
MIT License
40 stars 3 forks source link

Plugin fails to load in vaults containing broken symbolic links #7

Open malaybasu opened 2 months ago

malaybasu commented 2 months ago

After installing and enabling the extension, there is no "trash" button on the ribbon and there is no "show trash explorer" in the command menu.

proog commented 2 months ago

Sorry to say I can't reproduce this in Obsidian 1.6.7. I followed this procedure:

  1. Created a new local vault in desktop Obsidian 1.6.7
  2. Opened settings and enabled community plugins
  3. Clicked "Browse"
  4. Searched for Trash Explorer
  5. Clicked "Install"
  6. Clicked "Enable"

The "Open trash explorer" icon then appeared as the last item in the ribbon and the two plugin commands became available. Can you share more information about your setup?

Arcitec commented 2 months ago

It works in Obsidian 1.6.7. It appeared in the left sidebar, and the command palette actions became available.

Then after I ran its "Open Trash" command, an extra trash button appeared in the top bar. Which wasn't there immediately after install.

It's definitely working.

image

proog commented 2 months ago

Thank you for the info @Arcitec. I'm closing this issue.

malaybasu commented 2 weeks ago

Seems like the problem was there was a symbolic link in my trash folder. It was preventing the extension to load.

Arcitec commented 2 weeks ago

@malaybasu @proog Interesting. Was the symbolic link broken, or leading to a location that Flatpak Obsidian cannot reach?

Maybe the trash extension should gracefully skip files that it doesn't have permission to open.

proog commented 2 weeks ago

Very interesting, that does sound like a bug. I'll try to take a look at this soon unless someone beats me to it :)

malaybasu commented 2 weeks ago

@Arcitec Not sure about broken link. I deleted the link. But this can be easily tested. I will test it and let you know.

Skipping file gracefully is a good idea.

proog commented 1 week ago

The issue does seem to be related to broken links. Obsidian's internal file system adapter throws an error when listing the files during this call (assuming a broken symlink inside .trash):

https://github.com/proog/obsidian-trash-explorer/blob/4d9bc2c4977d79af116b369904c8f68d1c164b28/src/models.ts#L28

There's no obvious workaround to add to the plugin, so I've reported the bug on the Obsidian forum.

As for valid symlinks, it's probably a good idea to ignore them for consistency with Obsidian's own file explorer. Symlinks are currently treated as any other file and can be deleted and restored, but symlinks won't be visible after restoring them.