FlorianWoelki / obsidian-iconize

Simply add icons to anything you want in Obsidian.
https://florianwoelki.github.io/obsidian-iconize/
MIT License
866 stars 59 forks source link

[Bug] Sub paths for FontAwesome icon packs are ignored #241

Closed binaryDiv closed 1 year ago

binaryDiv commented 1 year ago

Describe the bug When downloading one of the FontAwesome icon packs (which all use different subdirectories of the same source zip file), the path attribute is ignored. As a result, the installed icon pack will consist of all .svg files that are found in the zip file instead of just the icons of the "Brands", "Regular" or "Solid" packs.

To Reproduce Steps to reproduce the behavior:

  1. Open plugin settings and install one of the FontAwesome icon packs (e.g. "FontAwesome Brands").
  2. Notice that the amount of total icons in the icon pack will be the same (2028), regardless of which pack you install.
  3. Open the "Change Icon" modal for a folder.
  4. The icon selection will contain all SVGs from the FontAwesome zip file. This also includes three non-displayable icons called "Brands", "Regular" and "Solid" which should not be included in any of the three packs (they come from the "sprites" directory instead of the "svgs" directory in the zip file).

Expected behavior Installing one of the FontAwesome icon packs should only install the SVGs from the subdirectory specified in the path attribute of the icon pack definitions, e.g. 'fontawesome-free-6.4.2-web/svgs/brands/'.

Screenshots Reported total icon count of "FontAwesome Brands":

2023-09-16_15-50-13

Actual file count per subdirectory in zip file (sums up to 2028):

fontawesome-free-6.4.2-web $ ls svgs/brands/ | wc -l
472
fontawesome-free-6.4.2-web $ ls svgs/regular/ | wc -l
163
fontawesome-free-6.4.2-web $ ls svgs/solid/ | wc -l
1390
fontawesome-free-6.4.2-web $ ls sprites/ | wc -l
3

Icon selector (should only contain the "Brands" icons; also notice the first three "icons"):

2023-09-16_15-51-26

Additional context I've noticed this bug while updating the icon packs (see #238). The numbers stated above are based on the updated version. However, I've also reproduced it with the previous version to make sure the bug was not introduced by me. (The reported total amount of icons was 1751 with the old version.)

I also went back to version 2.1.2 and can confirm everything was working as intended in that version, so the bug likely was introduced by the new syncing mechanism.

I've tried to debug the code, and apparently the path information is not used anymore when parsing the zip file. However, I'm not familiar enough with the code base to know the correct place to fix it, so sadly this is just a bug report and not a pull request with a fix. ^^'

FlorianWoelki commented 1 year ago

This issue has been resolved. I am currently waiting for the name change in the obsidian releases repository. Then I'll release the newest version.

FlorianWoelki commented 1 year ago

This has been released in v2.3.0.

dmekhov commented 1 year ago

Looks like the problem is still actual.
When I download some FA pack, I'v got full archive in my icons folder

.obsidian\icons> ls

6412139 font-awesome-brands.zip
6412139 font-awesome-regular.zip
6412139 font-awesome-solid.zip
FlorianWoelki commented 1 year ago

Looks like the problem is still actual. When I download some FA pack, I'v got full archive in my icons folder

.obsidian\icons> ls

6412139 font-awesome-brands.zip
6412139 font-awesome-regular.zip
6412139 font-awesome-solid.zip

This is not an issue and is intended. You need to actually apply icons to see a directory with your applied icons.

dmekhov commented 1 year ago

You need to actually apply icons to see a directory with your applied icons.

indeed, but why do you suggest any of 3 packs to choose and download all icons from source? (duplicating files and causing to use extra space and traffic in sync services, if it used)

so why are these 3 optional packs better than the one full pack?

FlorianWoelki commented 1 year ago

You need to actually apply icons to see a directory with your applied icons.

indeed, but why do you suggest any of 3 packs to choose and download all icons from source? (duplicating files and causing to use extra space and traffic in sync services, if it used)

so why are these 3 optional packs better than the one full pack?

If you just need one pack, then you can just install the one you need.