Admin setting -> Click to Collections and fields -> Click to some field -> Toggle required -> Click SaveToggled required without error.
Toggled required with 500 error.
$ curl 'https://directus.local/_/fields/post/content' -X PATCH -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'Referer: https://directus.local/admin/' -H 'Content-Type: application/json;charset=utf-8' -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNTU3ODkzOTc4LCJ0eXBlIjoiYXV0aCIsImtleSI6IkFlZDFhZXBoYWU3T25haWRvbzBjYWVHb2hzN1dlZTdPIiwicHJvamVjdCI6Il8ifQ.kM6cDgiE9eu6V6vHF--srdHDYIm2u5H0B48EuWs_FQQ' -H 'Connection: keep-alive' -H 'Cookie: __cfduid=df27f248e24c4efbaa82ddad80cb8400f1557842991; PHPSESSID=tmdbsh6l2m3nsgvhkgiv4ec7o3' -H 'TE: Trailers' --data '{"id":446,"sort":null,"field":"content","type":"string","datatype":"VARCHAR","interface":"text-input","default_value":null,"options":{"trim":true,"showCharacterCount":true,"formatValue":false,"width":"auto"},"readonly":false,"required":false,"unique":false,"note":"","hidden_detail":false,"hidden_browse":false,"primary_key":false,"validation":null,"width":"full","length":"200"}'
{"error":{"code":null,"message":"Invalid key \"tag!entity_directus_fields_text-input\". Valid filenames must match [a-zA-Z0-9_\\.! ]."}}
I have the same issue with PHP 7.2 and mariadb 10.2.14
I cleared it like this.
File: vendor/cache/cache/src/Adapter/Filesystem/FilesystemCachePool.php
Before:
private function getFilePath($key)
{
if (!preg_match('|^[a-zA-Z0-9_\.! ]+$|', $key)) {
throw new InvalidArgumentException(sprintf('Invalid key "%s". Valid filenames must match [a-zA-Z0-9_\.! ].', $key));
}
return sprintf('%s/%s', $this->folder, $key);
}
After:
private function getFilePath($key)
{
$key = sha1($key);
return sprintf('%s/%s', $this->folder, $key);
}
This problem affects not only the collection but also the user directory.
@gnh1201
Not able to replicate this issue in the latest version. Can you please check it once with the latest build?
As this issue is not reproducible in the latest version; I am closing this. Feel free to reopen it.
I encountered the same issue with version 190807A. As @gnh1201 already mentioned this issue seems related to filesystem cache. The propsed workaround does solve the problem for me for now but its not really a solution.
@bjgajjar the file naming convention is incorrect when creating the cache on filesystem. this is not compliant with regex |^[a-zA-Z0-9_\.! ]+$|. It need fix.
@gnh1201 The FilesystemCachePool.php is from the vendor. So we are suggesting not to make direct changes in the vendor directory.
Duplicate of #1206
Most helpful comment
I encountered the same issue with version
190807A. As @gnh1201 already mentioned this issue seems related to filesystem cache. The propsed workaround does solve the problem for me for now but its not really a solution.