silverstripe / silverstripe-asset-admin

Silverstripe assets gallery for asset management
BSD 3-Clause "New" or "Revised" License
19 stars 78 forks source link

v2 UploadField Regression: "You cannot upload any more files" #1352

Closed chrispenny closed 1 year ago

chrispenny commented 1 year ago

Setup

private static array $has_one = [
    'HeroImage' => Image::class,
];
$fields->addFieldsToTab(
    'Root.Hero',
    [
        UploadField::create('HeroImage', 'Hero Image'),
        ...
    ]
);

Description

  1. Select a file in your UploadField
  2. Save your Page/DO
  3. Reload edit form
  4. Remove the file from the UploadField
  5. Select "Upload new"
  6. Select a file to upload

Result: "You cannot upload any more files"

https://user-images.githubusercontent.com/505788/233233955-ea414c81-2c88-428e-95f1-098cff40191f.mov

v1

Tested the same behaviour in a Silverstripe 4 project, and did not experience this behaviour.

Acceptance criteria

PRs

GuySartorelli commented 1 year ago

Just for the sake of clarity, I'm assuming this is with a has_one relationship? Did you set any additional config (either globally or per instance) for the upload field or validator?

chrispenny commented 1 year ago

Thanks, @GuySartorelli. Correct, it's a has_one (added to the description).

The project is also running KFC and Fluent, but KFC doesn't impact anything until after a write is performed, and for Fluent this field is not localised.

GuySartorelli commented 1 year ago

I can definitely reproduce this, but I can't figure out what's causing it. I can see that the number of files that our react components are aware of is correct all throughout the process. I've also console logged the files array from the underlying dropzone instance and that seems to always be correct as well. So I'm not sure what's causing it to think we've hit the limit.

GuySartorelli commented 1 year ago

PR merged @chrispenny You can use 2.0.x-dev as a dependency constraint for now if you need to, but we're intending to launch CMS 5 stable pretty soon.

chrispenny commented 1 year ago

Thanks, team!!

purplespider commented 1 year ago

I'm still getting a seemingly related "You can not upload any more files." bug in 5 stable.

To reproduce:

  1. Upload a file to an empty UploadField.
  2. Save/Create
  3. Create a new Page/DO
  4. Upload a file to the empty UploadField.

Result: "You can not upload any more files."

If I reload the page, then it will let me upload as expected.

Screenshot 2023-05-26 at 15 03 24

Should I open a new issue for this?

chrispenny commented 1 year ago

@purplespider I can confirm the same behaviour in my project as well.

My set up is (roughly):

  1. Create an Item
  2. Upload an Image
  3. Save and/or Publish the Item
  4. Use the [+] action to create a new Item
  5. Attempt to upload another Image

Result: "You can not upload any more files."

I will leave it to @GuySartorelli to determine if this should be a new Issue?

emteknetnz commented 1 year ago

Please create a new issue and link back to this one