-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] "upload_multiple" field within subfields of a "relationship" field does not allow files to be deleted #5392
Comments
When I debug the variables within Request
Result
Also the empty upload itself (0 => null), when only deleting something or saving an empty I am also struggling with the request validation of I would also be available for a hands-on debugging session if possible to have both problems resolved. Cheers, |
Hello @daPhantom thanks for the feedback. I feel your pain in finding the bug and appreciate the time you gave to debug & report. I will assign my colleague @pxpm to take over from here. Thanks again, Please report anything you found missing/confusing/wrong and we will try our best to address it. Cheers 🙏 |
Hey @pxpm I tested this and I can confirm where it stops working. I quickly tried this in the demo's monster CRUD: [
'name' => 'postalboxes',
'label' => 'HasMany (1-n) <small>+ subfields</small>'.backpack_new_badge(),
'subfields' => [
[
'name' => 'postal_name',
'type' => 'upload_multiple',
'withFiles' => true,
],
],
'wrapper' => [
'class' => 'form-group col-md-4',
],
'tab' => 'Relationship',
], From the above,
|
Hey @daPhantom thanks for the report 🙏 I've fixed the issue in 6.4.2, you should be able to get the fix with You should use the Validators we provide for a better experience validating upload fields. Have a look at https://backpackforlaravel.com/docs/6.x/custom-validation-rules#validuploadmultiple-for-upload_multiple-field-type Let us know if you are still experience issues. If you find other issues you can open a new issue report and we will look into it. Cheers |
Bug report
What I did
Define a "upload_multiple" field as a subfield of a "relationship".
Then upload some files and try to remove a file.
What I expected to happen
File will be removed after save.
What happened
File still persists. Sometimes even empty files
[{}]
do pop up which break the column forupload_multiple
.What I've already tried to fix it
I have checked the JS part and also the
\Backpack\CRUD\app\Library\Uploaders\MultipleFiles
. It looks like the path to retrieve the deleted files is broken in case of subfields.The
get()
key will resolve to 'clear_documents'. Instead the request is build like this, when using subfields and therefore the result will always be null.Is it a bug in the latest version of Backpack?
After I run
composer update backpack/crud
the bug... is it still there?Yes. No new updates as of now.
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:PHP VERSION:
PHP 8.2.8 (cli) (built: Jul 28 2023 13:55:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies
LARAVEL VERSION:
10.34.2.0
BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.2
backpack/crud: 6.3.2
backpack/devtools: 2.0.3
backpack/generators: v4.0.2
backpack/permissionmanager: 7.1.1
backpack/pro: 2.0.18
backpack/revise-operation: 2.0.0
backpack/theme-tabler: 1.1.2
The text was updated successfully, but these errors were encountered: