From c0e354428af2c69bf7638911320888f049ec0659 Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Sat, 1 Mar 2025 17:23:31 +0100 Subject: [PATCH] fix(boards): case-sensitive board names in url (#2454) --- packages/api/src/router/board.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api/src/router/board.ts b/packages/api/src/router/board.ts index 900b49ca6..cd8c4ee4a 100644 --- a/packages/api/src/router/board.ts +++ b/packages/api/src/router/board.ts @@ -5,7 +5,7 @@ import { z } from "zod"; import { constructBoardPermissions } from "@homarr/auth/shared"; import type { DeviceType } from "@homarr/common/server"; import type { Database, InferInsertModel, InferSelectModel, SQL } from "@homarr/db"; -import { and, asc, createId, eq, handleTransactionsAsync, inArray, isNull, like, not, or } from "@homarr/db"; +import { and, asc, createId, eq, handleTransactionsAsync, inArray, isNull, like, not, or, sql } from "@homarr/db"; import { createDbInsertCollectionWithoutTransaction } from "@homarr/db/collection"; import { getServerSettingByKeyAsync } from "@homarr/db/queries"; import { @@ -554,7 +554,7 @@ export const boardRouter = createTRPCRouter({ return await getFullBoardWithWhereAsync(ctx.db, boardWhere, ctx.session?.user.id ?? null); }), getBoardByName: publicProcedure.input(validation.board.byName).query(async ({ input, ctx }) => { - const boardWhere = eq(boards.name, input.name); + const boardWhere = eq(sql`UPPER(${boards.name})`, input.name.toUpperCase()); await throwIfActionForbiddenAsync(ctx, boardWhere, "view"); return await getFullBoardWithWhereAsync(ctx.db, boardWhere, ctx.session?.user.id ?? null);