Skip to content

Admin file upload with blank=True fails due to a missing file #286

Closed
@herrbenesch

Description

@herrbenesch

Hey there, thank you for this useful project.

I'm using
django ==5.0.3
django-s3file ==5.5.5
django-storages ==1.14.2

I'm using django-pictures with django-s3file to serve and store my images.
I have a model field setup like so

    image = PictureField(
        _("image"),
        upload_to=FilePattern(
            filename_pattern=("fancy-pattern),
        ),
        aspect_ratios=["1/1"],
        storage=some_s3_storage,
        blank=True,
        file_types=["WEBP", "JPEG"],
        width_field="image_width",
        height_field="image_height",
    )

Now if I try to save an instance of the model in the admin, I'm getting the following error message:

TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
  at Function.from(<anonymous>)
  at uploadFiles(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:164)
  at ? (/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:2879)
  at Array.forEach(<anonymous>)
  at uploadS3Inputs(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:2835)
  at HTMLFormElement.<anonymous>(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:3350)

If I remove blank=True from the model definition, the upload works without a problem.
Do you have an idea what is wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions