welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

html_type is overwritten when local wordpress_path is '/html' #616

Open drdogbot7 opened 3 years ago

drdogbot7 commented 3 years ago

Describe the bug When the local wordpress_path is set to '/html' this causes a database push to change the 'html_type', replacing '/html' with the remote_path.

For instance if the remote path is "/var/www/html" the "html_type" will change from "text/html" to "text/var/www/html".

image

This changes the content_type that Wordpress sends to the browser in the response headers:

image

Since this is an invalid content type, the browser will default to displaying the page as plain text (chrome) or prompting the user to download a file (Firefox).

welaika/docker-wordmove uses '/html' as the default working directory, so it is probably not uncommon for this to happen.

Wordmove command wordmove push -d

Presumably the same issue would affect the pull command if the remote path was '/html'

Expected behavior wordmove should NOT change "html_type" in the "wp_options" table.

movefile.yml

local:
  wordpress_path: /html

staging:
  wordpress_path: /var/www/html

Environment: welaika/docker-wordmove wordmove 5.0.2 ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

alessandro-fazzi commented 2 years ago

In 6.0 database string transformation will be done using a regex like

from \A/html\Z -> to /whatever/the/path

meaning that only the whole word /html will be considered.

This will be A LOT slower on huge databases, but correctness of execution is absolutely more important.

Thank you for taking the time to open the detailed report.

And please, do not use the alpha version containing the fix against production or important installation.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.