-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Files incorrectly identified as plain text if folder's name has got the "#" char #4333
Comments
Nominating for sprint 28. |
I've taken a quick look into this and found a root cause. It's because of how LanguageManager (language/LanguageManager.js:190) interacts with path-utils.js. Since PathUtils is designed to path URLs, it naturally assumes that "#" is a selector (fragment identifier) part of the URL. When file path is parsed, filename is left empty (rightfully so, since "dir/#id" is a valid URL syntax) and further language detection does not work. Perhaps relying on PathUtils is not the best way to get the file name (unless it someone wants to url-encode it and the decode back). It's much easier to avoid the entire URL vs. OS file path thing and just look for the filename as basename(1) does it. |
Suggested fix in #4379 |
PathUtils is really a misnomer--it should be named URLUtils--but it's a third-party library so we can't change the name :) We shouldn't be using it for general file handling though. |
Reviewed. To @RaymondLim to review @busykai's pull request as well. |
Fix #4333 (Files incorrectly identified as plain text if folder's name has got the "#" char)
- Switch to safer path-parsing code (see adobe/brackets#4333)
As said in the title, I have a local folder called "## WEB" where I have all my different websites in subfolders.
If I try to open a HTML/CSS/PHP/whatever file with Brackets Sprint 26, the text is all grey because it's incorrectly identified as a plain text file (in the bottom-right corner of the application it says "text").
As soon as I change the folder's name to "WEB", everything works OK.
The text was updated successfully, but these errors were encountered: