getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

Can select non-images in image block #4189

Closed moritzebeling closed 2 years ago

moritzebeling commented 2 years ago

Description

When adding a new image block, I can easily select any file type, even non-image files like PDFs, ZIPs or audio. As the output snippet expects only images, I think it should only be possible to select images in the first place.

When I look into kirby/config/blocks/image/image.yml I can see that there is no filtering going on:

name: field.blocks.image.name
icon: image
preview: image
fields:
  # ...
  image:
    label: field.blocks.image.name
    type: files
    multiple: false
    image:
      back: black
    uploads:
      template: blocks/image
    when:
      location: kirby
  # ...

The image field would need a query: page.images to only allow images to be selected.

To reproduce

  1. Have a blueprint with a block editor
  2. Login to panel
  3. Upload a non Image file
  4. Create a new image block
  5. Click on "Select file" and check if you can select that non-image file

Your setup

Kirby Version 3.6.2

bastianallgeier commented 2 years ago

✅ will be fixed in 3.6.4