From 5f5b7e6f072aa59cb4d577a8af312e3cc3605a0c Mon Sep 17 00:00:00 2001 From: devleejb Date: Fri, 2 Aug 2024 23:31:35 +0900 Subject: [PATCH] Change `encodeURIComponent` to `encodeURI` --- backend/src/check/check.service.ts | 2 +- backend/src/users/users.service.ts | 2 +- backend/src/workspaces/workspaces.controller.ts | 3 ++- backend/src/workspaces/workspaces.service.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/check/check.service.ts b/backend/src/check/check.service.ts index 8306887d..8fe80751 100644 --- a/backend/src/check/check.service.ts +++ b/backend/src/check/check.service.ts @@ -15,7 +15,7 @@ export class CheckService { ) {} async checkNameConflict(name: string): Promise { - const encodedText = encodeURIComponent(name); + const encodedText = encodeURI(name); const conflictUserList = await this.prismaService.user.findMany({ where: { OR: [{ nickname: name }, { nickname: encodedText }], diff --git a/backend/src/users/users.service.ts b/backend/src/users/users.service.ts index c7d58a21..c44a7369 100644 --- a/backend/src/users/users.service.ts +++ b/backend/src/users/users.service.ts @@ -94,7 +94,7 @@ export class UsersService { }, }); - const encodedText = encodeURIComponent(nickname); + const encodedText = encodeURI(nickname); if (!userWorkspaceList.length) { const { id: workspaceId } = await this.prismaService.workspace.create({ diff --git a/backend/src/workspaces/workspaces.controller.ts b/backend/src/workspaces/workspaces.controller.ts index a1e6371d..7aa9957c 100644 --- a/backend/src/workspaces/workspaces.controller.ts +++ b/backend/src/workspaces/workspaces.controller.ts @@ -68,7 +68,8 @@ export class WorkspacesController { @Req() req: AuthroizedRequest, @Param("workspace_slug") workspaceSlug: string ): Promise { - return this.workspacesService.findOneBySlug(req.user.id, encodeURIComponent(workspaceSlug)); + console.log(encodeURI(workspaceSlug)); + return this.workspacesService.findOneBySlug(req.user.id, encodeURI(workspaceSlug)); } @Get("") diff --git a/backend/src/workspaces/workspaces.service.ts b/backend/src/workspaces/workspaces.service.ts index aca25e8f..df4c9035 100644 --- a/backend/src/workspaces/workspaces.service.ts +++ b/backend/src/workspaces/workspaces.service.ts @@ -30,7 +30,7 @@ export class WorkspacesService { const workspace = await this.prismaService.workspace.create({ data: { title, - slug: encodeURIComponent(title), + slug: encodeURI(title), }, });