husjon / obsidian-file-cleaner-redux

A plugin for Obsidian to help clean up files in your vault
MIT License
28 stars 2 forks source link

Specifying .* for Attachment extensions #39

Closed CompletelyHarmless closed 6 months ago

CompletelyHarmless commented 6 months ago

Hi, this is a great plugin! The . option doesn't appear to work, ie, it doesn't find unused attachments. If I specify .png, it works fine. Thanks, David

husjon commented 6 months ago

Hi, thanks for raising the issue.

I am unfortunately not able to replicate this. F.ex when I set it up like the following image I get the following files ready for cleanup: image

Also, make sure that the plugin has been update to at least v0.8.3, since there were an issue with extensions not being registered correctly previously.

CompletelyHarmless commented 6 months ago

Thanks for your quick response, I'm on a Windows PC and I have version 0.8.3 of the plugin, and your example is what I'm expecting to see. I've been experimenting some more, but I just can't get it to detect unused attachments with .* If I specify the extensions, eg, ".png, .jpeg", it successfully detects the unused attachments. David

husjon commented 6 months ago

Hmm strange. I'm on Linux myself but I do not think that should make much of a difference since Obsidian is crossplatform and the plugin uses all of Obsidians APIs.

In any case I'll try to spin up a Windows Virtual Machine to see if I can replicate it.

husjon commented 6 months ago

I spun up a brand new Windows 11 VM and I was able to replicate the issue. It seem like for somewhat reason the regular expression pattern for extensions is not working as expected on Windows.

For now I'll suggest just using explicit patterns (.png, .pdf etc) until it's fixed. I'll update as soon as I have a fix ready.

CompletelyHarmless commented 6 months ago

Thanks for that. FYI, I notice the same issue on Android. But, I also found that ..* works! (with the extra dot). David

husjon commented 6 months ago

I've just made a change which updates the regular expression pattern and the wildcard .* now works as expected both on Windows and Linux. :)

It will be part of v0.8.5 and should be available shortly.