From 6fc783933646d48921853541c3ae2b2e34c53766 Mon Sep 17 00:00:00 2001 From: marttinm Date: Fri, 10 Jul 2026 16:18:03 -0300 Subject: [PATCH] fix(game-data): degrade gracefully when items_game_cdn is unavailable items_game_cdn.txt was removed from SteamDatabase/GameTracking-CS2 and its raw.githubusercontent.com URL now 404s (see csfloat/inspect#250). items_game_cdn therefore stays false forever, and the enrichment guard in addAdditionalItemProperties bailed out entirely whenever it was falsy, silently dropping floatvalue/paintseed/paintindex/names for every inspected item. The CDN file only ever fed the optional imageurl field, which is not consumed by any downstream consumer in this fork. Split the guard so enrichment only requires items_game and csgo_english, and make the imageurl lookup conditional on items_game_cdn actually being loaded. --- lib/game_data.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/game_data.js b/lib/game_data.js index 44f629d4..c9166b12 100644 --- a/lib/game_data.js +++ b/lib/game_data.js @@ -172,7 +172,12 @@ class GameData { Given returned iteminfo, finds the item's min/max float, name, weapon type, and image url using CSGO game data */ addAdditionalItemProperties(iteminfo) { - if (!this.items_game || !this.items_game_cdn || !this.csgo_english) return; + // items_game_cdn is optional: SteamDatabase/GameTracking-CS2 no longer ships + // items_game_cdn.txt (see https://github.com/csfloat/inspect/issues/250), so it + // will permanently be false in practice. Only the imageurl field depends on it — + // everything else (floatvalue/paintseed/paintindex/names) only needs items_game + // and csgo_english, so we must not let a missing CDN file block enrichment. + if (!this.items_game || !this.csgo_english) return; // Get sticker codename/name const stickerKits = this.items_game.sticker_kits; @@ -222,11 +227,13 @@ class GameData { weapon_name = this.items_game['items'][iteminfo.defindex]['name']; } - // Get the image url - let image_name = weapon_name + skin_name; + // Get the image url (best-effort: items_game_cdn is frequently unavailable upstream) + if (this.items_game_cdn) { + let image_name = weapon_name + skin_name; - if (image_name in this.items_game_cdn) { - iteminfo['imageurl'] = this.items_game_cdn[image_name]; + if (image_name in this.items_game_cdn) { + iteminfo['imageurl'] = this.items_game_cdn[image_name]; + } } // Get the paint data and code name