You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When uploading a file in a section without a defined file template and sortable: false, Sort: NaN is inserted in the file’s content file. The file is then displayed at the end the section.
Expected behaviour
In Kirby 3, the files were sorted by name.
To reproduce
Can be reproduced in the Starterkit in site/blueprints/pages/album.yml from line 40:
When there is no template and not sortable, attributes is actually empty (see https://github.com/getkirby/kirby/blob/main/config/sections/files.php#L194-L200). In turn, attributes is not an empty object but actually ends up as an empty array in JS world. And .sort on an array is a method, which is why the if statement gets entered and then NaN is the result.
Some ideas:
Check for Array.isArray(this.attributes) === false in upload.js
Remove the array_filter call from fields.php to ensure that attributes is always an object
Description
When uploading a file in a section without a defined file template and
sortable: false
,Sort: NaN
is inserted in the file’s content file. The file is then displayed at the end the section.Expected behaviour
In Kirby 3, the files were sorted by name.
To reproduce
Can be reproduced in the Starterkit in
site/blueprints/pages/album.yml
from line 40:Your setup
Kirby Version
4.0.1
The text was updated successfully, but these errors were encountered: