Skip to content
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] CRUD Repeatable field with sub field image. Use withFiles param path broken file after update model. #5549

Open
dimkys opened this issue Jul 2, 2024 · 2 comments
Assignees

Comments

@dimkys
Copy link

dimkys commented Jul 2, 2024

Bug report

What I did

I added a repeatable field with an image subfield.
The image has parameters: 'withFiles' => [ 'disk' => 'public', 'path' => 'registration-steps',],

When creating everything works fine, but when updating there is a problem.

CRUD::addField([
            'name' => 'images',
            'label' => 'Images',
            'type' => 'repeatable',
            'subfields' => [
                [
                    'name' => 'image',
                    'type' => 'image',
                    'label' => 'Image',
                    'withFiles' => [
                        'disk' => 'public',
                        'path' => 'registration-steps',
                    ],
                    'wrapper' => ['class' => 'form-group col-md-4'],
                ],

            ],
            'min_rows' => 0,
            'reorder' => true,
        ]);

What I expected to happen

After creation. I change the data (associated with inages) and save. The data has changed and everything is fine.
And this json data not changed "[{\"image\":\"registration-steps\\\/7AASbQ8QU8QaUR9dRJOj82rNUaKnbINpzomGCYtu.jpeg\"},{\"image\":\"registration-steps\\\/4fb9ggIdOL6FCAVA7buJQ8q4zkA2VFy8iJtnXobT.png\"}]"

What happened

Data in field images broken, file deleted from disk and in db images = "[{\"image\":\"7AASbQ8QU8QaUR9dRJOj82rNUaKnbINpzomGCYtu.jpeg\"},{\"image\":\"4fb9ggIdOL6FCAVA7buJQ8q4zkA2VFy8iJtnXobT.png\"}]".

What I've already tried to fix it

So far the fix is ​​to not use 'path' in 'withFiles'

Is it a bug in the latest version of Backpack?

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

Backpack, Laravel, PHP, DB version

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

PHP VERSION:

8.1.28

PHP EXTENSIONS:

Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, readline, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, mbstring, igbinary, openssl, sockets, Phar, curl, enchant, exif, fileinfo, ftp, gd, gettext, imagick, intl, mysqli, odbc, pdo_mysql, pdo_pgsql, pdo_sqlite, soap, sqlite3, timezonedb, xmlrpc, xsl

LARAVEL VERSION:

10.48.7.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.2.1
backpack/crud: 6.7.15
backpack/devtools: 2.0.3
backpack/editable-columns: 3.0.9
backpack/filemanager: 3.0.4
backpack/generators: v4.0.2
backpack/langfilemanager: 5.0.0
backpack/logmanager: v5.0.1
backpack/permissionmanager: 7.0.1
backpack/pro: 2.2.0
backpack/settings: 3.1.0
backpack/theme-tabler: 1.1.1

@dimkys dimkys added the triage label Jul 2, 2024
Copy link

welcome bot commented Jul 2, 2024

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use GitHub Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - GitHub Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

@dimkys dimkys changed the title [Bug] CRUD Repeatable field with sub field image. Use withFiles para [Bug] CRUD Repeatable field with sub field image. Use withFiles param path broken file after update model. Jul 2, 2024
@pxpm
Copy link
Contributor

pxpm commented Jul 8, 2024

Hello @dimkys thanks for the report.

We are aware of some issues related with uploaders and we have already a big PR to update them. The PR is in testing phase. #5478

There is also a companion PR for that one in PRO that targets the image uploader.

We hope to merge it during this month. I will keep this issue open until we do that and let you know, so that you can update to the fixed versions.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants