mirror of
https://github.com/directus/directus.git
synced 2026-02-16 10:15:14 -05:00
App: encode primary key (#5143)
* app: encode primary key Since primary keys could be manually entered strings, we should encode those in order to prevent accessing inexistent routes. E.g. Document with primary key: 'clients/John Doe' * fixup! app: encode primary key Since primary keys could be manually entered strings, we should encode those in order to prevent accessing inexistent routes. E.g. Document with primary key: 'clients/John Doe' Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -234,7 +234,7 @@ export default defineComponent({
|
||||
try {
|
||||
const endpoint = relatedCollection.value.collection.startsWith('directus_')
|
||||
? `/${relatedCollection.value.collection.substring(9)}/${props.value}`
|
||||
: `/items/${relatedCollection.value.collection}/${props.value}`;
|
||||
: `/items/${relatedCollection.value.collection}/${encodeURIComponent(props.value)}`;
|
||||
|
||||
const response = await api.get(endpoint, {
|
||||
params: {
|
||||
|
||||
@@ -149,7 +149,7 @@ export default defineComponent({
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/items/${props.collection}/${props.primaryKey}`, {
|
||||
const response = await api.get(`/items/${props.collection}/${encodeURIComponent(props.primaryKey)}`, {
|
||||
params: {
|
||||
fields: getFieldsToFetch(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user