Welcome Guest, Not a member yet? Register   Sign In
Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path)
#10

The issue is caused by the sanitizeFilename method on line 301 of the file vendor/codeigniter4/framework/system/Autoloader/Autoloader.php. The function transforms a path such as /com~apple~CloudDocs/sites, which is perfectly legitimate on a Mac, into /comappleCloudDocs/sites, rendering all paths invalid.

I solved the issue by changing line 307:

PHP Code:
$filename preg_replace('/[^0-9\p{L}\s\/\-\_\.\:\\\\]/u'''$filename); 
To
PHP Code:
$filename preg_replace('/[^0-9\p{L}\s\/\-\_\.\:\\\\~]/u'''$filename); 
I don't know if there is a better way to avoid making changes to system files, but with this modification, CI4 works from iCloud directory on Mac.
Reply


Messages In This Thread
RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - by Francesco Smelzo - 03-05-2023, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB