J3.x

資料夾名稱開頭無法使用英文字母以外的字元

From Joomla! Documentation

This page is a translated version of the page J3.x:Unable to use a none alphabethic first character in folder name and the translation is 53% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎français • ‎italiano • ‎中文(台灣)‎ • ‎中文(繁體)‎

更網站新到 Joomla 2.9.25之後,試著使用 com_media 或是 mod_random_image 來設定圖片或檔案路徑時,如果選擇英文字母外的字元開頭的,會導致錯誤。

受影響的版本

基本資訊

這會影響 Joomla! 版本: 3.9.25

什麼原因

由於安全更新,我們不再接受com_media設置中的圖片相對路徑設定。相同的過濾器也套用到 mod_random_image 的資料夾設定值。假如您想要使用英文字母 a-z 以外的字元做開頭,例如 "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.

如何修改

等候更新到 Joomla 3.9.26

如果您真的很需要的話,使用以下的迴避技巧

同時間在檔案 libraries/src/Form/Rule/FilePathRule.php (File on Github) 中移除行 53 到 56