Commit 9919240
committed
Make tar extraction more robust and permissive
Open archives with a permissive compression mode (r:*) and only extract regular files. Skip members with empty basenames or where extractfile() returns None, use a context manager for file streams, and raise a ReadError if no regular files were extracted to fail loudly. Preserve previous fallback: if the file isn't an archive, copy it as a direct model file. Also update example usage to remove the explicit remove_hf_folder argument.1 parent 673ff9a commit 9919240
1 file changed
Lines changed: 27 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
131 | 150 | | |
| 151 | + | |
132 | 152 | | |
133 | 153 | | |
134 | 154 | | |
| |||
158 | 178 | | |
159 | 179 | | |
160 | 180 | | |
161 | | - | |
| 181 | + | |
162 | 182 | | |
163 | 183 | | |
164 | 184 | | |
| |||
0 commit comments