Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files have two icons next to them #198

Closed
ARMIsNOTLoaded opened this issue Jul 5, 2023 · 7 comments
Closed

Files have two icons next to them #198

ARMIsNOTLoaded opened this issue Jul 5, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@ARMIsNOTLoaded
Copy link

ARMIsNOTLoaded commented Jul 5, 2023

Describe the bug
Suddenly some files have two icons next to them, one is unclearable, I tried disabling the plugin, uninstalling it and/or the icon pack, moving the icon pack, nothing worked.

To Reproduce
I have no idea how to reproduce this bug, it appeared randomly one day.

Expected behavior
That the files have just one icon, the default behavior of the plugin.

Screenshots
image

Additional context
Knowing how to reset everything and clear icon's data inside a vault would be a great help for now.

UPDATE: I found the problem.
The issue appears only on PNG files I link in notes: the PNG file gets assigned the same icon as the note, and if you add another icon to the PNG itself it will show two icons. There is no way to get rid to the note's icon unless you remove it from the note where the PNG was embedded.

IDK if this is a normal behavior, it didn't do that until the day I opened this thread. I will behave accordingly knowing that.

UPDATE 2: it seems to trigger between folders and files if they contain the same words.
As an example, I have a folder named "Monsters" with an icon "dog".
Then if I create, anywhere in the vault, a note with "Monsters" in its name (i.e. "Amulet of Monsters").
This note WILL have the "dog" icon regardless. Can't remove it unless I remove "Monsters" from its name or remove the icon from the "Monsters" folder. If I assign another icon to the note, it will show two icons.

@RazMag
Copy link

RazMag commented Jul 11, 2023

Not a solution but I believe you can remove VAULT-FOLDER\.obsidian\plugins\obsidian-icon-folder\data.json to 'reset' your vault. if you have a syncing solution this might be problematic though

@ARMIsNOTLoaded
Copy link
Author

ARMIsNOTLoaded commented Jul 12, 2023

Not a solution but I believe you can remove VAULT-FOLDER\.obsidian\plugins\obsidian-icon-folder\data.json to 'reset' your vault. if you have a syncing solution this might be problematic though

I want to thank you because this solved my problem entirely and the plugin is now working fine.

UPDATE: I found the problem.
The issue appears only on PNG files I link in notes: the PNG file gets assigned the same icon as the note, and if you add another icon to the PNG itself it will show two icons. There is no way to get rid to the note's icon unless you remove it from the note where the PNG was embedded.

IDK if this is a normal behavior, it didn't do that until the day I opened this thread. I will behave accordingly knowing that.

UPDATE 2: it seems to trigger between folders and files if they contain the same words.
As an example, I have a folder named "Monsters" with an icon "dog".
Then if I create, anywhere in the vault, a note with "Monsters" in its name (i.e. "Amulet of Monsters").
This note WILL have the "dog" icon regardless. Can't remove it unless I remove "Monsters" from its name or remove the icon from the "Monsters" folder. If I assign another icon to the note, it will show two icons.

@Net-Slayer
Copy link

I think this might be the culprit? from inspecting the packaged main.js

const doesExistInPath = (plugin, path) => {
    const folders = getFolders(plugin);
    return Object.keys(folders).some((folderPath) => path.includes(folderPath));
};

for me I experience the same issue with "05. Meta/Templates" and "05. Meta/Temp", where the icons double up because one can be considered a substring of another.

const inputString = "05. Meta/Templates";
const searchString = "05. Meta/Temp";

const result = inputString.includes(searchString);

console.log(result); // Output: true

Net-Slayer added a commit to Net-Slayer/obsidian-icon-folder that referenced this issue Aug 19, 2023
…d folders

+ Appended '/' to the end of folderPath strings in inheritance folder checks

For issue: FlorianWoelki#198
@califa
Copy link

califa commented Aug 31, 2023

Also experiencing this, up to 3 icons so far :)

image

@FlorianWoelki
Copy link
Owner

Could you please give a rough outline on how to reproduce this issue with minimal effort?

Thank you!

@FlorianWoelki FlorianWoelki added the bug Something isn't working label Sep 1, 2023
@FlorianWoelki FlorianWoelki self-assigned this Sep 1, 2023
@Net-Slayer
Copy link

Sure, my tests were with the word "Understandable"

Create the following folders/files for testing:

  • Under/Stand/Able.md

  • Under/Able/Stand.md

  • Able/Stand/Under.md

  • Able/Under/Stand.md

  • Stand/Under/Able.md

  • Stand/Able/Under.md

  • Under/Understand.md

  • Understand/Under.md

  • Under/Understand/Understandable.md

  • Understandable/Understand/Under.md

Assign inheritance icons to each top and mid level folder.
Assign icons to files.

You should notice stacking icons.
This is due to path.includes(), but it's ok it just needs a more sophisticated check for parent folders/child folders in inheritance.ts

@FlorianWoelki
Copy link
Owner

This should be fixed in 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants