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

[>5.4]: Uploading assets in front-end form replaces existing assets #15809

Closed
tommysvr opened this issue Sep 30, 2024 · 4 comments
Closed

[>5.4]: Uploading assets in front-end form replaces existing assets #15809

tommysvr opened this issue Sep 30, 2024 · 4 comments
Assignees
Labels

Comments

@tommysvr
Copy link

What happened?

Description

Since 5.4.0, a saving an entry in a front-end form replaces existing assets. Verified this was working as expected in 5.3.6

Steps to reproduce

Upload a new asset to an entry with existing assets from a front-end form:

<form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
  {{ csrfInput() }}
  {{ actionInput('entries/save-entry') }}
  {{ hiddenInput('entryId', entry.id) }}

  <label for="title">Title</label>
  {{ input('text', 'title', entry.title, {id: 'title',}) }}

  {% for relatedAssetId in entry.assets.ids() %}
    {{ input('text','fields[assets][]',relatedAssetId) }}
  {% endfor %}

  {{ input('file', 'fields[assets][]', options={multiple: true}) }}

  <button type="submit">Publish</button>
</form>

Expected behavior

New asset will be added to existing assets

Actual behavior

All existing assets are removed and only the new asset is saved to the entry

Craft CMS version

5.4.0

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@tommysvr tommysvr added the bug label Sep 30, 2024
@Anubarak
Copy link
Contributor

Did you try version 5.4.3?
#15707

@tommysvr
Copy link
Author

Did you try version 5.4.3? #15707

Yep still happening on 5.4.6 (latest) and report in support from 5.4.4.

@i-just
Copy link
Contributor

i-just commented Oct 1, 2024

Thanks for the clear replication steps, Tommy! I raised a PR for this.

@brandonkelly
Copy link
Member

Craft 5.4.7 is out with that additional fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants