Problem/Motivation
When the drupal site it setup with a base_url that is inside a subdirectory of the domain, a CM Document export will put the subdirectory in the file name. However the import command will not be looking for the subdirectory name, so it fails to find the file to import.
Steps to reproduce
Site with base url = https://example.com/mydrupal/
Export a CM Document
Notice the file name is `mydrupalzZzALIASzZzOFzZzPAGE.yml`
But when you import the page if you use:
- drush content-model-documentation:import /mydrupal/ALIAS/OF/PAGE the import will create a new document because there are not aliases in Drupal that begin with `mydrupal` (the site's sub-directory)
- drush content-model-documentation:import /ALIAS/OF/PAGE the import will not work at all because it can't find an import file by that name.
Temp Workaround
Edit the export filenames to remove the subdirectory and the first zZz (which is the equivalent of a / )
Proposed resolution
There are two choices here (I am not sure which is best yet, but I am leaning toward #2.)
- Detect the subdirectory and remove if from the export file name before export. - This would force the import runner to use the path not including the subdirectory in the import command, which may be a little confusing.
- Detect the subdirectory just before looking up the alias and remove it. - This would allow the full path of the destination CM Document to be used in the import command.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork content_model_documentation-3428591
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
Comment #3
swirtCrediting majorrobot for surfacing this bug and helping determine what the problem is.
Comment #4
swirtComment #6
majorrobot commentedI've tested the MR on my local (which has Drupal in a subdirectory) and can confirm I can export and import correctly. Thank you, @swirt!
Comment #8
swirtThank you @majorrobot. This has been merged and will be released shortly in 1.0.28
Comment #9
swirtReleased as part of 1.0.28
Comment #10
swirtI decided in this approach to do both 1 and 2. So the subdirectory(s) will not appear in the export file name, AND when you do the import, whether or not you use the subdirectory(s) in the import path (alias) will make no difference. The import will take place correctly.