fix: unable to load documents with non-standard ids (#9407)
### What? Non-standard ids caused an issue when finding the document on the server. This is an odd regression, in 2.0 we were fetching the document on the client so the request would handle decoding the url. Now we are fetching the document on the server and need to do this manually when reading id from route params. ### Why? The slug pulled out of the url for an id of `id 1` would equate to `id%201` which would fail in the `payload.find` call since there is not an id stored as `id%201` but instead `id 1`. ### How? Wherever we are calling payload.find in the views and querying by `id` it gets ran through a helper function that decodes it properly. Fixes #9373
This commit is contained in:
@@ -39,6 +39,7 @@ export interface Config {
|
||||
'code-fields': CodeField;
|
||||
'collapsible-fields': CollapsibleField;
|
||||
'conditional-logic': ConditionalLogic;
|
||||
'custom-id': CustomId;
|
||||
'date-fields': DateField;
|
||||
'email-fields': EmailField;
|
||||
'radio-fields': RadioField;
|
||||
@@ -80,6 +81,7 @@ export interface Config {
|
||||
'code-fields': CodeFieldsSelect<false> | CodeFieldsSelect<true>;
|
||||
'collapsible-fields': CollapsibleFieldsSelect<false> | CollapsibleFieldsSelect<true>;
|
||||
'conditional-logic': ConditionalLogicSelect<false> | ConditionalLogicSelect<true>;
|
||||
'custom-id': CustomIdSelect<false> | CustomIdSelect<true>;
|
||||
'date-fields': DateFieldsSelect<false> | DateFieldsSelect<true>;
|
||||
'email-fields': EmailFieldsSelect<false> | EmailFieldsSelect<true>;
|
||||
'radio-fields': RadioFieldsSelect<false> | RadioFieldsSelect<true>;
|
||||
@@ -121,9 +123,9 @@ export interface Config {
|
||||
user: User & {
|
||||
collection: 'users';
|
||||
};
|
||||
jobs: {
|
||||
jobs?: {
|
||||
tasks: unknown;
|
||||
workflows: unknown;
|
||||
workflows?: unknown;
|
||||
};
|
||||
}
|
||||
export interface UserAuthOperations {
|
||||
@@ -948,6 +950,15 @@ export interface ConditionalLogic {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-id".
|
||||
*/
|
||||
export interface CustomId {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "date-fields".
|
||||
@@ -1796,6 +1807,10 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'conditional-logic';
|
||||
value: string | ConditionalLogic;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'custom-id';
|
||||
value: string | CustomId;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'date-fields';
|
||||
value: string | DateField;
|
||||
@@ -2587,6 +2602,15 @@ export interface ConditionalLogicSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-id_select".
|
||||
*/
|
||||
export interface CustomIdSelect<T extends boolean = true> {
|
||||
id?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "date-fields_select".
|
||||
|
||||
Reference in New Issue
Block a user