mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 02:56:22 +00:00
fix: 修复获取用户语言时的潜在错误,确保安全访问用户属性
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 11s
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 11s
This commit is contained in:
@ -28,8 +28,8 @@ export async function getUserLocales(): Promise<string[]> {
|
|||||||
const token = cookieStore.get('token')?.value || '';
|
const token = cookieStore.get('token')?.value || '';
|
||||||
const refreshToken = cookieStore.get('refresh_token')?.value || '';
|
const refreshToken = cookieStore.get('refresh_token')?.value || '';
|
||||||
const user = (await getLoginUser({token, refreshToken})).data;
|
const user = (await getLoginUser({token, refreshToken})).data;
|
||||||
locales.push(user.language);
|
locales.push(user?.language || '');
|
||||||
locales.push(user.language.split('-')[0]);
|
locales.push((user?.language || '').split('-')[0]);
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
const languageInCookie = cookieStore.get('language')?.value;
|
const languageInCookie = cookieStore.get('language')?.value;
|
||||||
|
Reference in New Issue
Block a user