Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Files incorrectly identified as plain text if folder's name has got the "#" char #4333

Closed
Manuito83 opened this issue Jun 25, 2013 · 5 comments
Assignees
Milestone

Comments

@Manuito83
Copy link

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.

@RaymondLim
Copy link
Contributor

Nominating for sprint 28.

@busykai
Copy link
Contributor

busykai commented Jul 3, 2013

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.

@busykai
Copy link
Contributor

busykai commented Jul 4, 2013

Suggested fix in #4379

@njx
Copy link
Contributor

njx commented Jul 8, 2013

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.

@ghost ghost assigned RaymondLim Jul 8, 2013
@njx
Copy link
Contributor

njx commented Jul 8, 2013

Reviewed. To @RaymondLim to review @busykai's pull request as well.

RaymondLim added a commit that referenced this issue Jul 16, 2013
Fix #4333 (Files incorrectly identified as plain text if folder's name has got the "#" char)
peterflynn added a commit to peterflynn/svg-preview that referenced this issue Jul 25, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants