Always convert petName to image hash in loadCustomPetData #1

Closed
dice wants to merge 2 commits from dice/impress-2020:always-use-@ into main
Showing only changes of commit 30718988b3 - Show all commits

View file

@ -33,13 +33,11 @@ export async function loadCustomPetData(petName) {
// prepending "@", which is a special code that can *also* be used in the // prepending "@", which is a special code that can *also* be used in the
// CustomPetService in place of name, to get a pet's appearance from its image // CustomPetService in place of name, to get a pet's appearance from its image
// hash. // hash.
if (petName.match(/^[0-9]/)) {
const imageHash = await loadImageHashFromPetName(petName); const imageHash = await loadImageHashFromPetName(petName);
console.debug( console.debug(
`[loadCustomPetData] Converted pet name ${petName} to @${imageHash}`, `[loadCustomPetData] Converted pet name ${petName} to @${imageHash}`,
); );
petName = "@" + imageHash; petName = "@" + imageHash;
}
try { try {
return neopetsAmfphpCall("CustomPetService.getViewerData", [petName]); return neopetsAmfphpCall("CustomPetService.getViewerData", [petName]);