diff --git a/.changeset/six-bags-play.md b/.changeset/six-bags-play.md new file mode 100644 index 0000000000..d2ca233980 --- /dev/null +++ b/.changeset/six-bags-play.md @@ -0,0 +1,5 @@ +--- +'@directus/app': patch +--- + +Fixed Files interface when used with custom junction field diff --git a/app/src/interfaces/files/files.vue b/app/src/interfaces/files/files.vue index e5a7b1715e..9025ed4e98 100644 --- a/app/src/interfaces/files/files.vue +++ b/app/src/interfaces/files/files.vue @@ -219,8 +219,9 @@ const downloadName = computed(() => { const junctionField = relationInfo.value.junctionField.field; const relationPkField = relationInfo.value.relatedPrimaryKeyField.field; - return displayItems.value.find((item) => get(item, [junctionField, relationPkField]))?.directus_files_id - ?.filename_download; + return displayItems.value.find((item) => get(item, [junctionField, relationPkField]) === relatedPrimaryKey.value)?.[ + junctionField + ]?.filename_download; }); const downloadUrl = computed(() => { @@ -238,6 +239,13 @@ function getFilename(junctionRow: Record) { return key; } +function getDownloadName(junctionRow: Record) { + const junctionField = relationInfo.value?.junctionField.field; + if (!junctionField) return; + + return junctionRow[junctionField]?.filename_download; +} + const customFilter = computed(() => { if (!relationInfo.value) return; @@ -335,7 +343,7 @@ const allowDrag = computed(