What type of bug are you reporting? Client
What is the bug?
(Please check more details in https://github.com/smogon/pokemon-showdown-client/issues/2720)
Replays involving a player with a custom (server-served) avatar crash with:
TypeError: Cannot read properties of undefined (reading 'port')
at _class2.resolveAvatar (https://play.pokemonshowdown.com/js/battledata.js:551:1216)
at BattleScene.getSidebarHTML (https://play.pokemonshowdown.com/data/graphics.js:745:49)
Are you able to replicate it? If so, how?
https://replay.pokemonshowdown.com/china-gen3ou-198548
Battle from the china server where players use custom avatars served from config/avatars/ (avatar string contains .). Open the replay → sidebar render aborts at the custom avatar.
Fall back to Config.defaultserver (always loaded from config.js):
if (avatar.includes('.')) {
const serverConfig = Config.server || Config.defaultserver;
if (!serverConfig) {
return Dex.resourcePrefix + 'sprites/trainers/' + Dex.sanitizeName('unknown') + '.png';
}
const protocol = (serverConfig.port === 443) ? 'https' : 'http';
const server = `${protocol}://${serverConfig.host}:${serverConfig.port}`;
return `${server}/avatars/${encodeURIComponent(avatar).replace(/%3F/g, '?')}`;
}
What is the bug?
(Please check more details in https://github.com/smogon/pokemon-showdown-client/issues/2720)
Replays involving a player with a custom (server-served) avatar crash with:
TypeError: Cannot read properties of undefined (reading 'port')
at _class2.resolveAvatar (https://play.pokemonshowdown.com/js/battledata.js:551:1216)
at BattleScene.getSidebarHTML (https://play.pokemonshowdown.com/data/graphics.js:745:49)
Are you able to replicate it? If so, how?
https://replay.pokemonshowdown.com/china-gen3ou-198548
Battle from the china server where players use custom avatars served from config/avatars/ (avatar string contains .). Open the replay → sidebar render aborts at the custom avatar.
Fall back to Config.defaultserver (always loaded from config.js):
if (avatar.includes('.')) {
const serverConfig = Config.server || Config.defaultserver;
if (!serverConfig) {
return Dex.resourcePrefix + 'sprites/trainers/' + Dex.sanitizeName('unknown') + '.png';
}
const protocol = (serverConfig.port === 443) ? 'https' : 'http';
const server = `${protocol}://${serverConfig.host}:${serverConfig.port}`;
return `${server}/avatars/${encodeURIComponent(avatar).replace(/%3F/g, '?')}`;
}
Last edited:

