An issue exists in mecha2's names.py:getRatID algorithm, where it can improperly detect a rat's alternate account in specific circumstances.
The issue stems from the algorithm iterating over the returned rats from the API, storing them in ret as temporary storage. If there are multiple rats on the filter platform, ret is overwritten with the latest entry, which may not be the rat object we are looking for. this ret rat object is then returned to the caller.
This algorithm does build a retlist object to track all the rats that match the specified filter, but subsequently does nothing with it. Based on some cursory testing, the API always returns the closest match to the searched nickname first, thus we should return the first object in retlist, should it exist.
This is a 1-liner PR that is tested to fix the reported issue by returning the first element in retlist, should it exist. Otherwise it defaults to the current behavior: returning ret.
An issue exists in mecha2's
names.py:getRatID
algorithm, where it can improperly detect a rat's alternate account in specific circumstances.The issue stems from the algorithm iterating over the returned rats from the API, storing them in
ret
as temporary storage. If there are multiple rats on the filter platform,ret
is overwritten with the latest entry, which may not be the rat object we are looking for. thisret
rat object is then returned to the caller.This algorithm does build a
retlist
object to track all the rats that match the specified filter, but subsequently does nothing with it. Based on some cursory testing, the API always returns the closest match to the searched nickname first, thus we should return the first object inretlist
, should it exist.This is a 1-liner PR that is tested to fix the reported issue by returning the first element in
retlist
, should it exist. Otherwise it defaults to the current behavior: returningret
.