From 6baddc10e9b17e5dc1bbf2de30d0464242491f94 Mon Sep 17 00:00:00 2001 From: FurbyOnSteroids Date: Sat, 16 Aug 2025 14:23:57 +0200 Subject: [PATCH] Fix non-unicode characters in game path (#193) * replace btoa with a Buffer implementation, as btoa does not support non-unicode characters. * replace btoa with a Buffer implementation, as btoa does not support non-unicode characters. * fix linting * fix linting * replace buffer implementation with a md5 hash. This also adds the ts-md5 library. * Revert "replace buffer implementation with a md5 hash. This also adds the ts-md5 library." This reverts commit f98b811ab99b9198a3c44fa216b8ee09edc9fab3. * replace buffer implementation with md5 hash from node:crypto * fix linting.. again --------- Co-authored-by: FurbyOnSteroids --- server/internal/library/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/internal/library/index.ts b/server/internal/library/index.ts index b26f6df..ce9f6ca 100644 --- a/server/internal/library/index.ts +++ b/server/internal/library/index.ts @@ -14,13 +14,18 @@ import notificationSystem from "../notifications"; import { GameNotFoundError, type LibraryProvider } from "./provider"; import { logger } from "../logging"; import type { GameModel } from "~/prisma/client/models"; +import { createHash } from "node:crypto"; export function createGameImportTaskId(libraryId: string, libraryPath: string) { - return btoa(`import:${libraryId}:${libraryPath}`); + return createHash("md5") + .update(`import:${libraryId}:${libraryPath}`) + .digest("hex"); } export function createVersionImportTaskId(gameId: string, versionName: string) { - return btoa(`import:${gameId}:${versionName}`); + return createHash("md5") + .update(`import:${gameId}:${versionName}`) + .digest("hex"); } class LibraryManager {