Aedif / TokenVariants

GNU General Public License v3.0
17 stars 12 forks source link

[BUG] Wildcard images include system files (e.g. Thumbs.db) #77

Closed safety-orange closed 1 year ago

safety-orange commented 1 year ago

Love this module, it is a great addition to my game!

I run Foundry on my Synology and access the data folders using a Windows machine. In doing so, Windows creates a "Thumbs.db" file in every folder that includes images. As a result of this, when I use wildcard token images, one of the results of the wildcard is Thumbs.db. Obviously, that doesn't make for a very nice token, as it is not an image file.

I would love it there was a way to exclude certain files/strings from the wildcard search (and those displayed in the HUD). I have tried adding it to the Search Filter >> excluded part of the settings, but this doesn't seem to have any affect (also not on anything shown in the HUD, but that's a separate, less annoying, issue).

Aedif commented 1 year ago

Hi, regarding non-image/video files popping up when using wildcard images, I can fix that up pretty quick.

Filters not affecting the wildcard images is intended as wildcards already require setup of folders and file names to work with it and it felt like an unecessary level of complexity on top of it. I also wanted to keep the functionality as close to 'Token HUD Wildcard' as possible for those meaning to seamlessly swap over. If you really want to apply filters to the wildcard images specifically I could consider it, but is it really necessary beyond just getting rid of unexpected files such as "Thumbs.db" (which I will fix and will not require filters)?

Now regarding module filters not being applied to the images in the HUD, I just tested it and it seems to work fine. The search performed by the module for the HUD is a 'Token' search so make sure that you setup the filters for that. It will affect all non-wildcard and non-shared (green arrow) images that get displayed there.

safety-orange commented 1 year ago

Thanks for the quick response! And thanks for the clarification of what the Search Filter does and doesn't do.

non-image/video files popping up when using wildcard images

I think this would be the best way to fix it. No hassle with custom filters, just getting rid of files that aren't usable anyway.

Now regarding module filters not being applied to the images in the HUD, I just tested it and it seems to work fine. The search performed by the module for the HUD is a 'Token' search so make sure that you setup the filters for that. It will affect all non-wildcard and non-shared (green arrow) images that get displayed there.

I tried it again and it seems to work, but only after rebuilding the cache, logging out, refreshing the browser, and logging back in. No idea which of those steps made it work, but rebuilding the cache alone wasn't enough.

 

One other thing I noticed though, is that wildcard searches are case-sensitive. I get that for the folder tree it should be case-sensitive, but for the file it would be nice if it could be case-insensitive. For example, I set the token image for a Ghoul to /assets/tokens/undead/*Ghoul*, but I when placing a token I never get the files with names that include "ghoul", only those that include "Ghoul".

Aedif commented 1 year ago

The wildcard search is using Foundry's default wildcard browse functionality which is case sensitive. If you wanted to get around this using your example you could change the wildcard to: /assets/tokens/undead/*{G,g}houl*

By the way the fix for non-image files has been pushed in release 3.5.2

safety-orange commented 1 year ago

the fix for non-image files has been pushed in release 3.5.2

Awesome!

The wildcard search is using Foundry's default wildcard browse functionality which is case sensitive. If you wanted to get around this using your example you could change the wildcard to: /assets/tokens/undead/{G,g}houl

This is great to know, I'll use that from now on! I couldn't really find the documentation by Foundry about searches, so just assumed this was something specific to your module.