getgrav / getgrav/grav-plugin-admin

File upload does not work in fieldset and list type

Open
#1,944 0 comments 0 reactions 1 assignee Claimed by @mahagr View on GitHub
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

Hi, I get this error when I upload an image on admin yet the image does not have specials characters:

> Bad filename error

To reproduce this error, it is necessary to add `article.yaml` file in `user/themes/your_theme/blueprints` and put this code:

```
title: Article
'@extends':
type: default
context: blueprints://pages

form:
fields:
tabs:
type: tabs
active: 1

fields:
content:
type: tab
fields:
content:
unset@: true

header.article:
ordering@: +2
type: fieldset
title: Article
icon: square
collapsed: false
collapsible: true
fields:
.image:
type: file
label: Image principale
random_name: true
multiple: false
destination: 'user/themes/project/images/uploads'
autofocus: false
accept:
- image/*
```

If we remove the fieldset, it works:

```
title: Article
'@extends':
type: default
context: blueprints://pages

form:
fields:
tabs:
type: tabs
active: 1

fields:
content:
type: tab
fields:
content:
unset@: true

header.article.image:
type: file
label: Image principale
random_name: true
multiple: false
destination: 'user/themes/project/images/uploads'
autofocus: false
accept:
- image/*
```

But if we add this on file type and we upload an image, it's not possible to submit the form:

```
validate:
required: true
```

These problems are the same if we use a `list` type instead of `fieldset` as parent of `file` type.

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.