enabledCssSnippets returns removed snippets

Steps to reproduce

In the sandbox vault, create and enable a snippet called test.css. Now app.vault.config.enabledCssSnippets will return ['test']. Then delete test.css (without disabling it first) and restart Obsidian. app.vault.config.enabledCssSnippets still returns ['test'].

Expected result

app.vault.config.enabledCssSnippets should not return non-exist snippets.

Actual result

app.vault.config.enabledCssSnippets returns previously-registered non-exist snippets.

Environment

  • Operating system: macOS 12.6.1
  • Debug info:
SYSTEM INFO:
	Obsidian version: v1.1.14
	Installer version: v1.1.9
	Operating system: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 21.6.0
	Login status: logged in
	Catalyst license: insider
	Insider build toggle: on
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 1
	Restricted mode: on

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.

Additional information

Notice that the debug info shows there is one enabled snippet. However, here is the info in the appearance tab:

1 Like

thanks

2 Likes

Going to mark this as #wontfix since it’s working as designed.

The reason we don’t prune this list is that a deleted snippet could just be a file that hasn’t been downloaded by a sync service yet.

If you’re accessing enabledCssSnippets, I suggest treating it like raw user input and validate that the files exist before using them.