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

Wrong Logo URL for emails sent by sys:cron:run when pub folder is root #545

Open
norgeindian opened this issue May 5, 2020 · 0 comments

Comments

@norgeindian
Copy link

To reproduce this issue, use the pub folder as root directory.
Following the Magento devdocs, we insert the following code in app/etc/env.php:
'directories' => [ 'document_root_is_pub' => true ]
see https://devdocs.magento.com/guides/v2.3/config-guide/prod/config-reference-envphp.html#directories and https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html#3-update-the-envphp-file as reference.

This setting should make sure, that Magento always recognizes, that the pub folder is the root directory.

We now added a custom cronjob, which sends out the regular Magento invoice email again.
Running this cronjob with magerun sys:cron:run sends out the email, but adds /pub/ to the logo url, so the logo can not be found anymore, as the root directory is already the pub directory.
So if the the logo is placed directly in the media folder and can be found under https://www.base-url/media/logo.png, the following url is given instead: https://www.base-url/pub/media/logo.png.

When I run the same cronjob using bin/magento, the media url is found and the logo is inserted correctly.

I debugged this a bit and found out, that \Magento\Framework\App\Filesystem\DirectoryListis not initialized correctly using n98magerun in this case.
To check for the config option mentioned earlier the function \Magento\Framework\Console\Cli::documentRootResolver is needed.

Would be great, if there would be a way to fix that, so that the output is actually the same as in the automatic cronjob.

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

No branches or pull requests

2 participants