fix: missing uid in bili_user causes undefined reference

This commit is contained in:
alikia2x (寒寒) 2025-03-02 18:17:43 +08:00
parent f7e71c22f6
commit 012887d1d9
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6

View File

@ -31,15 +31,19 @@ export async function getVideoInfoFromAllData(client: Client, aid: number) {
[aid],
);
const row = queryResult.rows[0];
let authorInfo = "";
if (row.uid && await userExistsInBiliUsers(client, row.uid)) {
const q = await client.queryObject<BiliUserType>(
`SELECT * FROM bili_user WHERE uid = $1`,
[row.uid],
)
const userRow = q.rows[0];
authorInfo = userRow.desc;
}
return {
title: row.title,
description: row.description,
tags: row.tags,
author_info: userRow.desc
author_info: authorInfo
};
}