getgrav / getgrav/grav-plugin-admin

filepicker produces error with multiple and preview_images

Open
#2,335 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

There is a wierd situation which produces an error on load of the admin edit view:
* a filepicker field with `preview_images: true` and `multiple: true`
* with one file selected

![screenshot of the error message](https://user-images.githubusercontent.com/3891444/214637085-04c36f12-882c-4a12-af17-68395b475b45.png)

Bonus: The preview image gets shown with one file selected, but not with multiple files selected.

I also can confirm it's not caused by number-only filenames (3.mpg) or files that are not images. This keeps reproducing with all-images content too.

I investigated this after it was [mentioned at discord](https://discord.com/channels/501836936584101899/506916956637495306/1067462603141546044) but i'm not smart enough to get my head around what's exactly happening in `themes/grav/app/forms/fields/filepicker.js`.

Here is an example blueprint snippet:
```yaml
header.gallery:
type: filepicker
label: Gallery
folder: 'self@'
preview_images: true
multiple: true
validate:
type: commalist
accept:
- jpg
- jpeg
- png
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.