Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.16k stars 894 forks source link

[Bug] Dropzone pro field doesn't execute 'fileNamer' #5367

Closed realtebo closed 1 year ago

realtebo commented 1 year ago

Bug report

What I did

I am executing

CRUD::field('invoice_file')
            ->type('dropzone')
            ->label('Invoice file pdf')
            ->withFiles([
                'disk' => 'invoices', // the disk where file will be stored
                'path' => '/', // the path inside the disk where file will be stored
                'fileNamer' => function($file, $uploader) {
                    Log::debug($file->getClientOriginalExtension());
                    return Str::uuid() . '.' . $file->getClientOriginalExtension();
                },
        ]);

What I expected to happen

I expected to 1 - Log 2 - Be able to add extension to the uuid

What happened

Dropzone fields works. Disk is correctly setted and also path.

But we doesn't see logs and doesn't work the changing of name

What I've already tried to fix it

Actually, nothing

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:                                                       
PHP 8.1.2 (cli) (built: Jan 19 2022 10:13:52) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
### LARAVEL VERSION:
10.29.0.0
### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.1
backpack/crud: 6.3.0
backpack/generators: v4.0.2
backpack/pro: 2.0.18
backpack/theme-coreuiv4: 1.1.1
realtebo commented 1 year ago

Sorry, possible duplicate of: https://github.com/Laravel-Backpack/CRUD/issues/5363

tabacitu commented 1 year ago

Yup, looks like it's the same thing. Let's move the conversation there please. I've passed it to Pedro but he's away. Might take us up to 1 week to solve this, sorry @realtebo . But we will.

pxpm commented 11 months ago

This has been fixed in backpack/pro 2.0.20. It was tagged just a few minutes so it should take a little bit to be picked up by the private repository. You can then get the fixes with a composer update backpack/pro.

Thanks for the report @realtebo 🙏

Cheers