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

On boot up, plugin suggests deleting "/". #37

Closed johnnynalley closed 6 months ago

johnnynalley commented 7 months ago

OS: iOS 17.3.1 Obsidian Version: 1.4.16 File-Cleaner-Redux Version: 0.8.3

Occasionally during Obsidian boot-up, the plugin will show a prompt asking if I want to clean "/". Usually, it'll say "/empty_file_1", "/empty_file_2", but I believe that it is asking if I want to delete the entirety of my root folder.

I have not tried to see what happens when I allow it to do so, and I have not been able to consistently reproduce this. It appears it only happens whenever I have multiple apps running at the same time as Obsidian, because I only notice this when Obsidian is slow to boot.

Anybody else experienced the same thing?

husjon commented 7 months ago

Hmm thanks for raising the issue. It should definitely not try to delete the root vault folder. It might be related to vault size and/or plugin load times but I need some more information to work with.

Do you have an overview of what the size of your vault is (amount of files / folders and disk usage). Also, do you use a lot of other plugins?

I should add in some debug logging that could be toggled on to help look into different issues.

johnnynalley commented 7 months ago

Hello,I have 126 files with 13 folders at 50.7 MB. At the moment, I have 23 plugins installed. When it happens again, I’ll be sure to grab a screenshot.On Feb 16, 2024, at 7:06 AM, Jon Erling Hustadnes @.***> wrote: Hmm thanks for raising the issue. It should definitely not try to delete the root vault folder. It might be related to vault size and/or plugin load times but I need some more information to work with. Do you have an overview of what the size of your vault is (amount of files / folders and disk usage). Also, do you use a lot of other plugins? I should add in some debug logging that could be toggled on to help look into different issues.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

husjon commented 6 months ago

Hi @johnnynalley, I've just pushed v0.8.4 which enables some debug logging for files and folders that are added to the cleanup cycle.

If you do see this happen again, you can now open the Obsidian Developer Console (using Ctrl+Shift+i / Cmd+Shift+i)

You should then see something along the lines of the following when enabling the Verbose level (see top-right). image (PS: This is an example using my development vault but should give you an indication of how it would look)

johnnynalley commented 6 months ago

Thank you!! It hasn't happened again in a few days at this point, but if it happens again, I'll certainly take a look.

johnnynalley commented 6 months ago

Okay, so it did it again. I'm not at my PC right now so unfortunately I can't pull up the logs...

image

husjon commented 6 months ago

Thanks for the update, annoying that it happened on the phone. I tried searching to see if it was possible to get the development console on the phone, but it does not seem like it's possible.

I might need to make a test build for you which logs to a file instead. Here's hoping that it'll happen again soon (sounds weird) on your PC :)

PS: I have by the way enabled the plugin to run on startup in my vault as well since the last week or so, but so far I've yet to see the issue.

johnnynalley commented 6 months ago

I'm open to testing a new build. At this point, it does it every time I start Obsidian. I had to turn off the option to clean folders to stop it.

husjon commented 6 months ago

Does it do it every time now on the phone, or the PC as well?

johnnynalley commented 6 months ago

I'm at my PC now. It does it every time on the PC and on iOS. Here is what the console logs look like:

image

Let me know if there is anything else I can do to assist.

johnnynalley commented 6 months ago

And here is it prompting me to delete the root folder on desktop:

image

husjon commented 6 months ago

Thanks for the quick feedback, could you expand the listing under Folders:

image

johnnynalley commented 6 months ago

Here ya go:

image

husjon commented 6 months ago

Thanks, and just so that I have something to try to replicate, what are the current settings for the plugin?

Also, if you were to create a new vault with just this plugin using the same settings, do you still see the same result?

johnnynalley commented 6 months ago

Oddly enough it works as expected in the new vault.

Settings (Same for both vaults):

image

image

Deletion prompt in new vault:

image

johnnynalley commented 6 months ago

Well I deleted and reinstalled the plugin and it seems to have fixed it. All of my settings are the exact same as before. I'm going to keep the "show confirmation" setting on because if it decides to happen again I don't want my root folder deleted.

husjon commented 6 months ago

Glad that reinstalling it worked and yeah definitely keep the "show confirmation" option on. I will still add a check for the root path and skip it if found, so that it cannot happen again.

I'll leave the issue open for a while longer in case you should see it again.

husjon commented 6 months ago

I've prepared a pull request which should fix this (in v0.8.6). It adds a guard clause so that it explicitly filters out the root folder.

The PR will close the issue, but don't hesitate to reopen the issue if you should see the issue again.

johnnynalley commented 6 months ago

Thank you so much!!