v8-archive
v8-archive copied to clipboard
Cannot add metadata on existing files
hi,
one cannot add metadata on existing files.
Version: 8.7.2
Reproduce here: https://demo.directus.io/admin/#/thumper/files/32
I think this PR may be part of the problem: https://github.com/directus/api/pull/1822
Setting metadata via REST is not possible either, but worked with Directus 8.6.
The error is in Directus FilesServices.php line 98 et sqq There 'metadata' has to be added, otherwise it will not be added to DB:
$recordData = ArrayUtils::defaults($recordData, ArrayUtils::pick($data, [
'title',
'tags',
'description',
'location',
'metadata'
]));
After that everything works fine.
Although there is a small bug in vue.js, when you have more than one metadata key-value pairs your browser console complains about multiple none unique id values e.g.
[DOM] Found 3 elements with non-unique id #value: (More info: https://goo.gl/9p2vKq)
<input data-v-52275a91 id="value" type="text" autocomplete="on" name pattern=".*" placeholder="Value" spellcheck="true" step="1" class="test charactercount monospace">
<input data-v-52275a91 id="value" type="text" autocomplete="on" name pattern=".*" placeholder="Value" spellcheck="true" step="1" class="test charactercount monospace">
<input data-v-52275a91 id="value" type="text" autocomplete="on" name pattern=".*" placeholder="Value" spellcheck="true" step="1" class="test charactercount monospace">
This is a typical error when you do not set id in vue as :id="key"
...
Probably caused by: https://github.com/directus/v8-archive/pull/1822