@@ -121,8 +121,12 @@ func (h *Handler) getAssetsNoCache(q Query) (string, Assets, error) {
121121 // only binary containers are supported
122122 // TODO deb,rpm etc
123123 fext := getFileExt (url )
124- if fext == "" && ga .Size > 1024 * 1024 {
125- fext = ".bin" // +1MB binary
124+ if fext == "" {
125+ // Check if this looks like a binary by checking for OS and Arch patterns
126+ // This handles assets like "joker_darwin_amd64" without extension
127+ if getOS (ga .Name ) != "" && getArch (ga .Name ) != "" && ga .Size > 1024 {
128+ fext = ".bin" // Likely a binary if it has OS/Arch in name and > 1KB
129+ }
126130 }
127131 switch fext {
128132 case ".bin" , ".zip" , ".tar.bz" , ".tar.bz2" , ".tar.xz" , ".txz" , ".bz2" , ".gz" , ".tar.gz" , ".tgz" :
@@ -175,6 +179,7 @@ func (h *Handler) getAssetsNoCache(q Query) (string, Assets, error) {
175179 URL : url ,
176180 Type : fext ,
177181 SHA256 : sumIndex [ga .Name ],
182+ Size : ga .Size ,
178183 }
179184
180185 key := asset .Key ()
@@ -201,7 +206,28 @@ func (h *Handler) getAssetsNoCache(q Query) (string, Assets, error) {
201206 g2m := gnu (other .Name ) && ! musl (other .Name ) && ! gnu (asset .Name ) && musl (asset .Name )
202207 // prefer musl over glib for portability, override with select=gnu
203208 if ! g2m {
204- continue
209+ // If both are gnu or both are not gnu/musl, prefer the larger file (usually static build)
210+ // This handles cases like joker_linux_amd64 (497KB static) vs joker_linux_amd64_gnu (39KB dynamic)
211+ if (gnu (other .Name ) == gnu (asset .Name )) && (musl (other .Name ) == musl (asset .Name )) {
212+ if ga .Size > other .Size {
213+ log .Printf ("preferring larger asset %s (%d bytes) over %s (%d bytes) for %s" ,
214+ ga .Name , ga .Size , other .Name , other .Size , key )
215+ } else {
216+ log .Printf ("skipping smaller asset %s (%d bytes), keeping %s (%d bytes) for %s" ,
217+ ga .Name , ga .Size , other .Name , other .Size , key )
218+ continue
219+ }
220+ } else {
221+ // Different gnu/musl status, prefer non-gnu (static) over gnu (dynamic)
222+ if ! gnu (other .Name ) && gnu (asset .Name ) {
223+ log .Printf ("skipping gnu asset %s, preferring static build %s for %s" ,
224+ ga .Name , other .Name , key )
225+ } else if gnu (other .Name ) && ! gnu (asset .Name ) {
226+ log .Printf ("replacing gnu asset %s with static build %s for %s" ,
227+ other .Name , ga .Name , key )
228+ }
229+ continue
230+ }
205231 }
206232 }
207233 index [key ] = asset
0 commit comments