v8-archive icon indicating copy to clipboard operation
v8-archive copied to clipboard

Cannot add metadata on existing files

Open rouuuge opened this issue 4 years ago • 3 comments

hi,

one cannot add metadata on existing files.

Version: 8.7.2

Reproduce here: https://demo.directus.io/admin/#/thumper/files/32

rouuuge avatar Jun 05 '20 12:06 rouuuge

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.

inta avatar Jul 07 '20 08:07 inta

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" ...

grandgeorg avatar Sep 23 '20 12:09 grandgeorg

Probably caused by: https://github.com/directus/v8-archive/pull/1822

ThaDaVos avatar Aug 17 '22 09:08 ThaDaVos