Skip to content

Node.js based forum software built for the modern web

fix: handle remote userslugs with non-lowercase letters

Julian Lamf5ea470df4fa
diff --git a/src/controllers/accounts/posts.js b/src/controllers/accounts/posts.js
index b12b00be9f..46ae337a38 100644
--- a/src/controllers/accounts/posts.js
+++ b/src/controllers/accounts/posts.js
@@ -180,7 +180,7 @@ async function getPostsFromUserSet(template, req, res) {
// exposeUid returns -2 for all remote users for ease of processing, restoring uid
let { uid } = res.locals;
if (uid === -2) {
- uid = await db.getObjectField('handle:uid', req.params.userslug);
+ uid = await db.getObjectField('handle:uid', req.params.userslug.toLowerCase());
}
const [{ username, userslug }, settings] = await Promise.all([
diff --git a/src/user/index.js b/src/user/index.js
index 971a2ab10d..3590c1c8ce 100644
--- a/src/user/index.js
+++ b/src/user/index.js
@@ -113,7 +113,7 @@ User.getUidByUserslug = async function (userslug) {
if (userslug.includes('@')) {
await activitypub.actors.assert(userslug);
- return (await db.getObjectField('handle:uid', userslug)) || null;
+ return (await db.getObjectField('handle:uid', String(userslug).toLowerCase())) || null;
}
return await db.sortedSetScore('userslug:uid', userslug);