model: fix case-insensitive suffix matching and skip .bak files in ListFilesInModelPath#10306
Merged
mudler merged 1 commit intoJun 13, 2026
Conversation
…stFilesInModelPath
mudler
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
huggingface_hubdownloads models into LocalAIs models directory, it creates aCACHEDIR.TAGfile. This file shows up in/v1/modelsbecause the suffix skip list contains.tag(lowercase), butstrings.HasSuffixis case-sensitive —CACHEDIR.TAG(uppercase) is therefore not matched.Additionally, backup files like
model.yaml.bak-pre-gpumem072appear in/v1/models. These are created e.g. when LocalAI backs up YAML configs before modifying them.Fix
strings.ToLowerbefore comparing against entries inknownModelsNameSuffixToSkip. This makes.tagmatchCACHEDIR.TAGand similar variants..bakdetection via contains-check: Backup files with suffixes like.bak-pre-gpumem072do not end exactly in.bak, so an additionalstrings.Contains(lowerName, ".bak")check is added..MDentry is removed (now redundant via case-insensitive.mdmatching)..DS_Storeis replaced by lowercased.ds_store.Reproduction
Affects any installation that uses
huggingface_hubfor model downloads or has YAML backup files in the models directory.