craftcms / craftcms/cms

Duplicating entries not working when using assets

Open
#3,690 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

When duplicating an entry I receive

An error occurred when duplicating the entry.

Caused by: Invalid subpath – craft\errors\InvalidSubpathException
The Image/Video field’s Upload Location setting has an invalid subpath (“{owner.owner.metaInformation.one.brandsNew.one.slug}”).
in /www/project/vendor/craftcms/cms/src/fields/Assets.php at line 741

Caused by: Invalid subpath – craft\errors\InvalidSubpathException
Could not resolve the subpath “{owner.owner.metaInformation.one.brandsNew.one.slug}”.
in /www/project/vendor/craftcms/cms/src/fields/Assets.php at line 641

This only happens when using assets with the entry. Entries of the same type that do not carry an asset are being duplicated. Even the same entry can be duplicated after removing the asset(s).

Just saving the entry works with and without assets.

The asset fields are nested within different supertables which again are being nested in a matrix field. Hence the owner.owner.

This has not been working in 3.0.x as well. I am now on 3.1.x.

I am unsure: is this the right place to post or should I open an issue for supertables?

Please let me know if I can assist with further information/debugging.

Additional info
  • Craft version: 3.1.3
  • PHP version: 7.2.14
  • Database driver & version: mysql 8.0
  • Plugins & versions: Super Table 2.1.5.3 (latest)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in vendor/craftcms/cms/src/fields/Assets.php at the reported lines 641 and 741, then reproduce duplication with an asset field nested through Super Table and Matrix fields. Trace how the owner.owner subpath is resolved during duplication. Done means entries with nested asset fields duplicate successfully, while entries without assets continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.