diff --git a/src/app/data/models/twitch/search-game/serializer.js b/src/app/data/models/twitch/search-game/serializer.js index 29e154b7b1..392cc45830 100644 --- a/src/app/data/models/twitch/search-game/serializer.js +++ b/src/app/data/models/twitch/search-game/serializer.js @@ -1,6 +1,9 @@ import TwitchSerializer from "data/models/twitch/serializer"; +const reStaticBoxArtRes = /\d+x\d+\.(\w+)$/; + + export default TwitchSerializer.extend({ modelNameFromPayloadKey() { return "twitch-search-game"; @@ -12,6 +15,14 @@ export default TwitchSerializer.extend({ normalize( modelClass, resourceHash, prop ) { const { primaryKey } = this; + + // workaround for: https://github.com/twitchdev/issues/issues/329 + /* istanbul ignore next */ + if ( resourceHash[ "box_art_url" ] ) { + resourceHash[ "box_art_url" ] = `${resourceHash[ "box_art_url" ]}` + .replace( reStaticBoxArtRes, "{width}x{height}.$1" ); + } + resourceHash = { [ primaryKey ]: resourceHash[ primaryKey ], game: resourceHash