fix: tweak user.search to better handle local usernames with colons in them

This commit is contained in:
Julian Lam
2024-03-13 15:41:41 -04:00
parent 83392f3ca2
commit c346177bb9

View File

@@ -94,9 +94,11 @@ module.exports = function (User) {
const data = await db.getSortedSetRangeByLex(`${searchBy}:sorted`, min, max, 0, hardCap); const data = await db.getSortedSetRangeByLex(`${searchBy}:sorted`, min, max, 0, hardCap);
// const uids = data.map(data => data.split(':').pop()); // const uids = data.map(data => data.split(':').pop());
const uids = data.map((data) => { const uids = data.map((data) => {
data = data.split(':'); if (data.includes(':https:')) {
data.shift(); return data.substring(data.indexOf(':https:') + 1);
return data.join(':'); }
return data.split(':').pop();
}); });
return uids; return uids;
} }