Skip to content

Corruption of data.json #669

@Kiryonn

Description

@Kiryonn

Describe the bug
A root folder named "settings" will not save a set icon.
Also, just putting an icon on this folder might make the extension delete its own settings.

To Reproduce

  1. Create a vault
  2. Create a folder called "settings"
  3. Add this plugin
  4. Add any icon to the "settings" folder
  5. Restart Obsidian

Expected behavior
Icon still present on the "settings" folder after obsidian restarts and not delete settings of the plugin.

Additional context
This is due to how you store the icons in data.json.

You currently use :

{
  "settings": {...},  // actual settings
// icons storage
  "medias/3d_models": "LiBox",
  "medias/documents": "LiFiles",
  "medias/images": "LiImages",
  "medias/music": "LiMusic",
  "medias/sounds": "LiAudioLines",
  "medias/videos": "LiFileVideo",
  "projects": "LiBlocks",
  "templates": "LiLayoutTemplate",
  "unsorted": "🔶"
}

A better way of doing it would be to create another field such as :

{
  "settings": {...},
  "icons": {
    "settings": "LiSettings",
    ...
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions