From e21688f14c61f347cd4c8f10f1fbdbd6dd84e59c Mon Sep 17 00:00:00 2001 From: FurbyOnSteroids Date: Sat, 16 Aug 2025 11:49:52 +0200 Subject: [PATCH] replace btoa with a Buffer implementation, as btoa does not support non-unicode characters. --- server/internal/library/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/internal/library/index.ts b/server/internal/library/index.ts index b26f6df0..7a7645f6 100644 --- a/server/internal/library/index.ts +++ b/server/internal/library/index.ts @@ -16,11 +16,15 @@ import { logger } from "../logging"; import type { GameModel } from "~/prisma/client/models"; export function createGameImportTaskId(libraryId: string, libraryPath: string) { - return btoa(`import:${libraryId}:${libraryPath}`); + const text = `import:${libraryId}:${libraryPath}`; + // base64 can contain "/" which breaks the URL. So we remove it + return Buffer.from(text, 'utf8').toString('base64').replaceAll("/", "") } export function createVersionImportTaskId(gameId: string, versionName: string) { - return btoa(`import:${gameId}:${versionName}`); + const text = `import:${gameId}:${versionName}`; + // base64 can contain "/" which breaks the URL. So we remove it + return Buffer.from(text, 'utf8').toString('base64').replaceAll("/", "") } class LibraryManager {