Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) (/showthread.php?tid=72950) Pages:
1
2
|
Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - jasonzig - 03-05-2019 CI4 breaks when it encounters a path that has a tilde(~) in it. Unfortunately, Apple uses tildes in its iCloud Drive path name, which is rendered as: Code: /Users/username/Library/Mobile Documents/com~apple~CloudDocs When using PHP's built-in web server on MacOS: Code: cd /Users/moo/Library/Mobile Documents/com~apple~CloudDocs/Sites/ci4b1/ Code: /Users/myname/Sites/ci4b1/ Code: /Users/myname/Library/Mobile Documents/com~apple~CloudDocs/Sites/ci4b1/ Code: Fatal error: Uncaught Error: Class 'Config\App' not found in /Users/myname/Library/Mobile Documents/com~apple~CloudDocs/Sites/ci4b1/vendor/codeigniter4/framework/system/Config/Config.php on line 139 The same fatal error returns when executing spark at the CLI if the CI4 folder is located in a path containing a tilde(~) . Code: ➜ ci4b1 pwd RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - jasonzig - 03-05-2019 Does anyone have an idea of how we can work around this? The error occurs in the final line of /Users/moo/Desktop/folder_with_a_tilde~/ci4b1/vendor/codeigniter4/framework/system/Config/Config.php in createClass where we are creating a new class instance using the name that was passed in. vendor/codeigniter4/framework/system/Config/Config::createClass(string $name): Code: /** RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - InsiteFX - 03-05-2019 From what I have read it's a short cut for you home folder. RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - jasonzig - 03-05-2019 (03-05-2019, 04:27 AM)InsiteFX Wrote: From what I have read it's a short cut for you home folder. Yes, it is the actual path to the mount points for MacOS iCloud Drive/ and iOS "Files" app. Since that remote storage mechanism is so useful for developers using MacOS, I'm trying to figure out how to get CodeIgniter 4 working there. RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - jasonzig - 03-07-2019 Anyone have an idea for a workaround? RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - InsiteFX - 03-07-2019 If you can get the path to the short cut then you should be able to just enter that as the url link. RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - jasonzig - 03-07-2019 (03-07-2019, 04:16 AM)InsiteFX Wrote: If you can get the path to the short cut then you should be able to just enter that Read my post and you'll see that I've done that. RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - ciadmin - 03-07-2019 Can you use a route for this, so that the tilde is not in the URL? RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - kilishan - 03-07-2019 Well, the obvious answer is don't store it in the iCloud drive Here's a workaround to expand the filenames, though I'm not sure how many different places would need to use that. I'm also unconvinced it's a good thing to have in core as it feels like it could be a security issue, though I'd have to think for a bit on when it could be safe and when not. RE: Tilde(~) in Path Breaks CI4 (used in iCloud Drive Path) - Francesco Smelzo - 03-05-2023 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); PHP Code: $filename = preg_replace('/[^0-9\p{L}\s\/\-\_\.\:\\\\~]/u', '', $filename); |