Lenson commited on
Commit
57cd044
·
1 Parent(s): 1450f4d

fix: correct download path for config/ and data/ directories

Browse files
Files changed (1) hide show
  1. .hf/setup.sh +35 -4
.hf/setup.sh CHANGED
@@ -39,10 +39,29 @@ download_from_supabase() {
39
 
40
  if [ -n "$config_list" ] && ! echo "$config_list" | grep -q "error"; then
41
  echo "$config_list" | grep -o '"name":"[^"]*"' | sed 's/"name":"//g' | sed 's/"//g' | while read -r remote_path; do
42
- if [ -z "$remote_path" ] || [ "$remote_path" = ".emptyFolderPlaceholder" ] || [ "$remote_path" = "config" ]; then
 
43
  continue
44
  fi
45
- local_path="/app/$remote_path"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  mkdir -p "$(dirname "$local_path")"
47
  if curl -s -L \
48
  -H "Authorization: Bearer $SUPABASE_KEY" \
@@ -64,10 +83,22 @@ download_from_supabase() {
64
 
65
  if [ -n "$data_list" ] && ! echo "$data_list" | grep -q "error"; then
66
  echo "$data_list" | grep -o '"name":"[^"]*"' | sed 's/"name":"//g' | sed 's/"//g' | while read -r remote_path; do
67
- if [ -z "$remote_path" ] || [ "$remote_path" = ".emptyFolderPlaceholder" ] || [ "$remote_path" = "data" ]; then
 
68
  continue
69
  fi
70
- local_path="/app/$remote_path"
 
 
 
 
 
 
 
 
 
 
 
71
  mkdir -p "$(dirname "$local_path")"
72
  if curl -s -L \
73
  -H "Authorization: Bearer $SUPABASE_KEY" \
 
39
 
40
  if [ -n "$config_list" ] && ! echo "$config_list" | grep -q "error"; then
41
  echo "$config_list" | grep -o '"name":"[^"]*"' | sed 's/"name":"//g' | sed 's/"//g' | while read -r remote_path; do
42
+ # Skip empty, placeholders, and directories (no file extension)
43
+ if [ -z "$remote_path" ] || [ "$remote_path" = ".emptyFolderPlaceholder" ] || [ "$remote_path" = "config" ] || [[ "$remote_path" =~ ^config/[^/]+$ ]] && [[ ! "$remote_path" =~ \. ]]; then
44
  continue
45
  fi
46
+
47
+ # Extract filename only
48
+ local filename=$(basename "$remote_path")
49
+
50
+ # Skip if it's a directory (no file extension)
51
+ if [ -z "$filename" ] || [ "$filename" = "$remote_path" ]; then
52
+ continue
53
+ fi
54
+
55
+ # Determine local path based on prefix
56
+ local local_path=""
57
+ if [[ "$remote_path" == config/prompts/* ]]; then
58
+ local_path="/app/config/prompts/$filename"
59
+ elif [[ "$remote_path" == config/* ]]; then
60
+ local_path="/app/config/$filename"
61
+ else
62
+ local_path="/app/$remote_path"
63
+ fi
64
+
65
  mkdir -p "$(dirname "$local_path")"
66
  if curl -s -L \
67
  -H "Authorization: Bearer $SUPABASE_KEY" \
 
83
 
84
  if [ -n "$data_list" ] && ! echo "$data_list" | grep -q "error"; then
85
  echo "$data_list" | grep -o '"name":"[^"]*"' | sed 's/"name":"//g' | sed 's/"//g' | while read -r remote_path; do
86
+ # Skip empty, placeholders, and directories
87
+ if [ -z "$remote_path" ] || [ "$remote_path" = ".emptyFolderPlaceholder" ] || [ "$remote_path" = "data" ] || [[ "$remote_path" == data/[^/]+$ ]] && [[ ! "$remote_path" =~ \. ]]; then
88
  continue
89
  fi
90
+
91
+ # Extract filename only
92
+ local filename=$(basename "$remote_path")
93
+
94
+ # Skip if it's a directory
95
+ if [ -z "$filename" ] || [ "$filename" = "$remote_path" ]; then
96
+ continue
97
+ fi
98
+
99
+ # Download to /app/data/
100
+ local local_path="/app/data/$filename"
101
+
102
  mkdir -p "$(dirname "$local_path")"
103
  if curl -s -L \
104
  -H "Authorization: Bearer $SUPABASE_KEY" \