fix: extract filename from source_pattern before calling find_model_files()
The source_pattern can include subdirectories (e.g., "unet/model.safetensors"), but find_model_files() filters by filename only. Now we: 1. Extract just the filename using basename 2. Find files matching that filename 3. Filter results to match the full source_pattern path This allows proper matching of files in subdirectories. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -619,9 +619,13 @@ link_model() {
|
||||
continue
|
||||
fi
|
||||
|
||||
# Find the specific file using its source pattern as filter
|
||||
# Extract just the filename from the source pattern (remove directory path)
|
||||
local filename_only
|
||||
filename_only=$(basename "$source_pattern")
|
||||
|
||||
# Find files matching the filename, then filter by full source pattern
|
||||
local source_file
|
||||
source_file=$(find_model_files "$repo_id" "$source_pattern" 2>/dev/null | head -n1)
|
||||
source_file=$(find_model_files "$repo_id" "$filename_only" 2>/dev/null | grep "/$source_pattern$" | head -n1)
|
||||
|
||||
if [[ -z "$source_file" ]] || [[ ! -f "$source_file" ]]; then
|
||||
print_warning "Source file not found: ${source_pattern}"
|
||||
|
||||
Reference in New Issue
Block a user