V8-archive: [v2.0.23] Invalid key "tag!entity_directus_fields_text-input". Valid filenames must match [a-zA-Z0-9_\.! ].

Created on 15 May 2019  路  7Comments  路  Source: directus/v8-archive

Bug Report

Steps to Reproduce

  1. Go to Admin setting -> Click to Collections and fields -> Click to some field -> Toggle required -> Click Save
  2. Show error. but it is toggled actually.

Expected Behavior

Toggled required without error.

Actual Behavior

Toggled required with 500 error.

Other Context & Screenshots

$ 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_\\.! ]."}}

Technical Details

  • PHP 7.0.0p1, mariadb-10.1.13
  • Install Method: upgrade to latest release
bug alt stack

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.

All 7 comments

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.

1206 is related to this issue and that issue has more information.

Duplicate of #1206

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitlabisbetterthangithub picture gitlabisbetterthangithub  路  3Comments

vuhrmeister picture vuhrmeister  路  3Comments

binary-koan picture binary-koan  路  3Comments

24js picture 24js  路  3Comments

metalmarco picture metalmarco  路  3Comments