Skip to content

Commit 5c84e65

Browse files
URI decode resourceId (#1791)
1 parent ed6ea50 commit 5c84e65

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/server/src/api/rest/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,15 +1231,16 @@ class RequestHandler extends APIHandlerBase {
12311231
}
12321232

12331233
private makePrismaIdFilter(idFields: FieldInfo[], resourceId: string) {
1234+
const decodedId = decodeURIComponent(resourceId);
12341235
if (idFields.length === 1) {
1235-
return { [idFields[0].name]: this.coerce(idFields[0].type, resourceId) };
1236+
return { [idFields[0].name]: this.coerce(idFields[0].type, decodedId) };
12361237
} else {
12371238
return {
12381239
// TODO: support `@@id` with custom name
12391240
[idFields.map((idf) => idf.name).join(prismaIdDivider)]: idFields.reduce(
12401241
(acc, curr, idx) => ({
12411242
...acc,
1242-
[curr.name]: this.coerce(curr.type, resourceId.split(this.idDivider)[idx]),
1243+
[curr.name]: this.coerce(curr.type, decodedId.split(this.idDivider)[idx]),
12431244
}),
12441245
{}
12451246
),

0 commit comments

Comments
 (0)