Closed rhlt closed 1 year ago
Hi, thanks for reporting! I raised a PR to adjust this.
Just fixed this for the next releases. Going forward, any folders that are selected will be ignored by the export.
Expected behavior
A file is downloaded that contains all data for all selected elements (in this case, all assets in the selected subfolder).
We can discuss that as a possibility down the road, but the current export functionality is not designed to scale beyond 100 elements exported at a time. This behavior would lead to major issues if you tried to export a folder with thousands of nested assets.
Craft 3.9.0 and 4.5.0 are out with that fix.
What happened?
Description
Craft CMS provides an "Export" button on all element pages in the CP; including Assets. This allows exporting the field data of all elements in the page. If one or more elements are selected, only those elements are exported. However, this does not work when a subfolder is selected. (Subfolders only exist for Assets.)
Steps to reproduce
Expected behavior
A file is downloaded that contains all data for all selected elements (in this case, all assets in the selected subfolder).
Actual behavior
A small pop up appears with the message "An internal server error occured."
Inspecting the network request sent by the CP reveals the following error:
This is the result of a request sent to the element-indexes/export controller action.
I also found that the payload contains a criteria parameter with an id key. It seems the value of id is expected to be an array of element IDs for the elements to be exported. However, when a subfolder is selected, an empty string ("") is added to the id array instead. This seems to be what causes the error.
Craft CMS version
4.4.17
PHP version
8.1.8
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response