joomla / framework.joomla.org

Application powering the internet home of the Joomla! Framework
https://framework.joomla.org
GNU General Public License v2.0
37 stars 28 forks source link

Joomla updates will fail when spaces in temp path #77

Closed smohila closed 1 year ago

smohila commented 2 years ago

As a follow up to https://github.com/joomla/joomla-cms/issues/35684 I would like to place this issue here:

Steps to reproduce the issue

Expected result

The joomla update process should run through as normal (update from 3.9.27 to 3.10.2).

Actual result

Update could not be installed. Got an error The checksum verification failed. Please make sure you are using the correct update server!.

Reason for this error

In file libraries/vendor/joomla/filter/src/InputFilter.php in method cleanPath (line 1017) a regexp for checking the path for Linux or Windows file systems fails. For Linux systems the patters is defined as:

$linuxPattern = '/^[A-Za-z0-9_\/-]+[A-Za-z0-9_\.-]*([\\\\\/]+[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/';

This pattern does not accept any spaces. Thus a tmp_path containing any spaces will fail.

Solution

The pattern should allow space, e.g.

$linuxPattern = '/^[A-Za-z0-9 _\/-]+[A-Za-z0-9 _\.-]*([\\\\\/]+[A-Za-z0-9 _-]+[A-Za-z0-9 _\.-]*)*$/';

Then the method cleanPath will return the correct path and the update process works as expected.

Additional comments

Tested/reproduced on Joomla! 3.9.27 trying to update to 3.10.2

PhilETaylor commented 2 years ago

https://github.com/joomla/joomla-cms/issues/35684#issuecomment-927958151

If you really must add a space in the regex please use \s and not just a white space space

gopalji commented 1 year ago

This problem is still not solved for Windows in Joomla 4

Hackwar commented 1 year ago

I opened a new issue in the right place. Closing here.