From 7a1e64862a9094158e042509ff06615cf98c5cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Tue, 25 Nov 2025 20:01:10 +0100 Subject: [PATCH] fix: extract filename from source_pattern before calling find_model_files() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- artifact_huggingface_download.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artifact_huggingface_download.sh b/artifact_huggingface_download.sh index 9941ffa..f888e11 100755 --- a/artifact_huggingface_download.sh +++ b/artifact_huggingface_download.sh @@ -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}"