mirror of
https://github.com/directus/directus.git
synced 2026-02-15 19:24:57 -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:
@@ -238,7 +238,7 @@ export default defineComponent({
|
||||
|
||||
const endpoint = props.collection.startsWith('directus_')
|
||||
? `/${props.collection.substring(9)}/${props.primaryKey}`
|
||||
: `/items/${props.collection}/${props.primaryKey}`;
|
||||
: `/items/${props.collection}/${encodeURIComponent(props.primaryKey)}`;
|
||||
|
||||
let fields = '*';
|
||||
|
||||
@@ -264,7 +264,7 @@ export default defineComponent({
|
||||
|
||||
const endpoint = collection.startsWith('directus_')
|
||||
? `/${collection.substring(9)}/${props.relatedPrimaryKey}`
|
||||
: `/items/${collection}/${props.relatedPrimaryKey}`;
|
||||
: `/items/${collection}/${encodeURIComponent(props.relatedPrimaryKey)}`;
|
||||
|
||||
try {
|
||||
const response = await api.get(endpoint);
|
||||
|
||||
Reference in New Issue
Block a user