I have recently updated Kirby from 3.5.X → 3.6.3.1, along with PHP 7.4 → 8.1 and all the required php extensions etc.
We’re now experiencing an issue with Kirby locating files with non-standard characters, which worked perfectly fine with Kirby 3.5.X.
As an example, a file called my_filename+_image.png
set in a file
field type. Kirby is looking for the file without the +
symbol in it, i.e. my_filename_image.png
in the above case. If I remove the +
from the filename, it does work as expected.
Can anyone identify what may have changed with Kirby or PHP that we can remedy without Find & Replace all affected files, as there are thousands of pages and files on this Kirby installation?
Many thanks in advance
How does this manifest? I’ve just tried by putting a
myfiles:
- my_filename+_image.png
in a content file that was next to a my_filename+_image.png
file and it seemed to work in 3.6.3.1:
echo $page->myFiles()->toFiles();
got me:
home/my_filename+_image.png
But that’s PHP 8.0 Same also in 8.1.4
What exactly is in your content file?
Hi @rasteiner
It’s actually not Kirby 3.6 - we’ve now identified the issue was present before, but no one ever noticed!
However, it is still an issue. I will revise the original post to reflect, but essentially:
- the front-end is totally fine with the file name
- the kirby methods work on the file
- the panel accepts them for upload, but removes the
+
from the filename when saving the file.
- blueprint fields will accept it being assigned, with or without the
+
The issue only occurs when you click the file in the panel and effectively open it with file
blueprint; at that point the file cannot be found.
These files must have been uploaded directly to the file system, not through the panel, so the +
is still in the filename, and it’s just the single file view/blueprint that doesn’t like the character.
To reproduce, what happens if you click your file in the panel to open the “single file” view? Do you get an error?
I can reproduce that files with such filenames cannot be opened in file view.