From 86721cd53538eb82765fa4e3c2153bfd78dc6a51 Mon Sep 17 00:00:00 2001 From: Hugo Tiburtino Date: Wed, 3 Jul 2024 01:40:07 +0200 Subject: [PATCH] fix(alias): encode path again to match the alias in database Before, the encoded path was sent to the database layer. It is strange that we decode, encode and decode it again, can't see the reason for it now. We may try not to encode it at all in the future. --- packages/server/src/schema/uuid/abstract-uuid/resolvers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/schema/uuid/abstract-uuid/resolvers.ts b/packages/server/src/schema/uuid/abstract-uuid/resolvers.ts index e5a8e25b0..df010545d 100644 --- a/packages/server/src/schema/uuid/abstract-uuid/resolvers.ts +++ b/packages/server/src/schema/uuid/abstract-uuid/resolvers.ts @@ -610,7 +610,7 @@ async function resolveIdFromAlias( return await resolveIdFromUsername(usernameMatch.groups.username, context) } - cleanPath = cleanPath.slice(1) + cleanPath = decodePath(cleanPath.slice(1)) // The following check is to avoid DB lookups for paths that we know do // not belong to UUIDs. This is a performance optimization. // Original code see https://github.com/serlo/database-layer/blob/71b80050ecda63d616ab34eda0fa1143cb9e3ddc/server/src/alias/model.rs#L17-L63