J3.x

Unable to use a none alphabethic first character in folder name

From Joomla! Documentation

Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎中文(繁體)‎ • ‎中文(台灣)‎

Websites updating to Joomla 3.9.25 trying to set an image or file path in com_media or a folder in mod_random_image which doesn't start with an alphabetic leads to an error.

Versions affected

General Information

This pertains only to Joomla! version(s): 3.9.25

What is the cause

Due to a security update we no longer allow relative path strings in com_media configuration for image path and file path setting. The same filter is used in mod_random_image for the folder property. In case you try to use a character other then a-z as first character you get an error message that this path is not allowed for example "1-images".

Important Information

When we talk about "folder" we only talk about the first main folder, not about subfolders. So creating "images/2021-03-01" is absolutely fine.

  • Did you change the default images main folder in Joomla! in the com_media options? If you didn't change it you won't have any issues
  • If "Yes", did you change the default images main folder to a folder starting with a non-alphabetic character (like "1-images" or "Ø-test")? If you didn't, you won't have any issues.
  • If "Yes" then you can't save the com_media options anymore. (But as mentioned before all media files are still working fine).

The same issue occurs in the "mod_random_image" module. Existing modules will continue working as before. If you create a new one and the first character in the folder path is a non-alphabetical character, you can't save the form.

How to fix

Update to Joomla 3.9.26 when it is released.

Use the following workaround only if you really need it!

In the meantime you remove the lines 53 to 56 in the file libraries/src/Form/Rule/FilePathRule.php (File on Github)