Exported location path is wrong if the file already existed

Created on 21 June 2024, 6 months ago

Problem/Motivation

If the exported file already exists, and Drupal/drush creates a new one with _0, _1 etc, the location in output from Drush is the file name that the module tried to use.

Steps to reproduce

Run something like drush content:export node --entities=11006 twice. The export location for both commands will be the same, but 2 files are generated.

🐛 Bug report
Status

Needs review

Version

1.4

Component

Code

Created by

🇬🇧United Kingdom mjpa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mjpa
  • Status changed to Needs review 6 months ago
  • 🇬🇧United Kingdom mjpa
  • 🇬🇧United Kingdom mjpa

    Created a MR with a fix, before, the output (for both times) was:

    Executing drush content:export node  --entities="11006"
    
     [notice] Message: Successfully exported the content. You can find the exported file at the
    following location:
    /var/core/www/scs-export/node-article-6a914ecd-c45c-4dd9-96f7-52db833ae391_14.yml

    With the fix applied, the 2nd execution gives the output:

    Executing drush content:export node  --entities="11006"
    
     [notice] Message: Successfully exported the content. You can find the exported file at the
    following location:
    /var/core/www/scs-export/node-article-6a914ecd-c45c-4dd9-96f7-52db833ae391_14_0.yml

    which contains the correct filepath.

  • Pipeline finished with Success
    6 months ago
    Total: 225s
    #204600
Production build 0.71.5 2024