Hey Everybody!
I’ve been using timoetting/kirby-builder for almost every project now, because of its flexibility and modularity. It has been great except for one bug which i’d like to help fix, but i’m not capable enough.
The Bug has been discussed in #110 and #148 in the kirby-builder repo and #175 in the kirby-editor repo
There was a fix/hack by alancwoo wich worked but is rather convoluted and prone to breaking when changing things.
Two weeks ago Jonathan Reisdorf found the culprit, described here:
There is a route in kirby core /kirby/config/api/routes/files.php
on Line 27 with a pattern (:all)/files
Commenting out the route, the image picker in kirby-builder works again, but the single pages for files break. It seems this gets picked over the route in kirby builder for some reason.
I tried changing some stuff and saw, in the route above, the pattern (:all?)
, with the question mark added. Changing the route in kirby core on Line 27 to
[
'pattern' => '(:all?)/files',
'method' => 'GET',
'action' => function (string $path) {
return $this->parent($path)->files()->sortBy('sort', 'asc', 'filename', 'asc');
}
],
seems to fix the bug in kirby builder and doesnt break the single pages for files.
I dont know what that does though, as i could not find anything concerning the questionmark inside dynamic placeholders in patterns. Can someone explain what this does and if this could be a viable fix to get around the bugs?
I would love to dig deeper myself, but my understanding of php and kirby isn’t there yet. Maybe this is a starting point for someone so i can pick it up again or something!
Thanks for any help in advance!