Problem/Motivation

If I restore content that results in an URL alias conflict, I get an error message that the content cannot be restored, but it actually was.

Steps to reproduce

  1. Enable Pathauto
  2. Enable Trash for both Content and URL Aliases.
  3. Create a page with a title of 'Test' (should get an automatic alias of '/content/test')
  4. Trash that page you just created
  5. Create another page with a title of 'Test' (should get an automatic alias of '/content/test')
  6. Attempt to restore your first page from the trash
  7. You will see an error message saying "The content item ... could not be restored from trash. Cannot restore path alias: An alias with the path "/content/test" already exists"
  8. However, your item is now out of the Trash and was restored, and is not visible in the Trash listing. It now has an alias of `content/test-0`

Proposed resolution

The error message should be updated or the behavior should be updated to reflect the message?

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Issue fork trash-3570621

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dave reid created an issue. See original summary.

dave reid’s picture

Issue summary: View changes

amateescu made their first commit to this issue’s fork.

amateescu’s picture

Status: Active » Needs work

Opened a MR with a test to kick things off.

amateescu’s picture

Status: Needs work » Needs review

The easiest solution would be to wrap the restoring process in a transaction, so exceptions from associated entities can bubble up.

  • amateescu committed d279b4be on 3.1.x
    fix: #3570621 Restoring content with a URL alias conflict still restores...

  • amateescu committed edf9fbe4 on 3.x
    fix: #3570621 Restoring content with a URL alias conflict still restores...
amateescu’s picture

Status: Needs review » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.