From 55dc20025ae4c23b7da7d315dc3a130f9dfeea77 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Wed, 27 Nov 2024 15:46:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20back:=20patch=20document=20retre?= =?UTF-8?q?ival=20for=20application=20users=20with=20non=20UUID=20name=20#?= =?UTF-8?q?747?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/node/src/services/documents/utils.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tdrive/backend/node/src/services/documents/utils.ts b/tdrive/backend/node/src/services/documents/utils.ts index dad901ef..6bae8632 100644 --- a/tdrive/backend/node/src/services/documents/utils.ts +++ b/tdrive/backend/node/src/services/documents/utils.ts @@ -50,8 +50,19 @@ export const isSharedWithMeFolder = (id: string) => { export const getVirtualFoldersNames = async (id: string, context: DriveExecutionContext) => { const configuration = new Configuration("drive"); const defaultLang = configuration.get("defaultLanguage") || "en"; - const user = await gr.services.users.get({ id: context.user?.id }); - const locale = user?.preferences?.locale || defaultLang; + const locale = await (async () => { + try { + const user = await gr.services.users.get({ id: context.user?.id }); + return user?.preferences?.locale || defaultLang; + } catch (error) { + logger.error( + { error, context }, + "Ignoring error getting user to translate root. This is expected from requests coming from applications as the user id is not a valid UUID for postgres. Defaulting to " + + defaultLang, + ); + return defaultLang; + } + })(); if (id.startsWith("user_")) { return gr.services.i18n.translate("virtual-folder.my-drive", locale);