-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED] Fix #4333 (Files incorrectly identified as plain text if folder's name has got the "#" char) #4056
Comments
Comment by busykai I also suggest that NativeFileSystem.Entry constructor (which is used to display base names in the project side bar) also takes advantage of the same FilUtils.getBaseName() facility. Currently, it's using splits path by separator and then iterates until the last name to get the base name for an entry. I intentionally programmed getBaseName so that it would support directories as well. |
Comment by njx To |
Comment by peterflynn Yikes, this suggests to me that we should never use PathUtils to parse local paths -- I bet this isn't the only place where a "#" in a file/folder name breaks stuff. It seems only safe to use PathUtils on things that are actually true URLs. I see potentially unsafe uses in DocumandCommandHandlers, JSUtils, FileIndexManager, and UrlCodeHints/main. Should we file a new bug for all that, or try to tackle them here? Also, some unit tests of the actual affected functionality (e.g. LanguageManager APIs) are probably a good idea... |
Comment by njx Yes, PathUtils is a misnomer--it should really be called URLUtils. But we didn't write it so we can't change the name :) I think it would be good to fix all of them at once if it's relatively straightforward to do so. |
Comment by busykai I can review the code for misuse of PathUtils. Should I file an issue? |
Comment by busykai Here is the report on usage of PathUtils in entire brackets codebase:
In order to fix this, two more methods corresponding to the usage of PathUtils have to be added: getDirectoryName (analogous to dirname(1)) and getFileExtension. I will amend this pull request. |
Comment by busykai This pull request is no good as is. Hold on until I update it, please. |
Comment by busykai I need your advice: what is normally done when the unit tests starts failing because of loading sequence/timing has changed due to a fix? I found that the fix is causing some unit tests to fail. I specifically looked into CSSUtils and found (after some banging my head against the wall) that the 43885a6 is changing the load sequence, so b87f6a0 fixes it. The other tests that are failing are trickier... For example some EditorCommandHandler tests do not have Commands loaded at the time of execution. One fails with "cannot read property EDIT_DELETE_LINES of null", for example. When re-ran on its own, it passes. I'm going to resolve all these, but please let me know what you think... |
Comment by busykai Nevermind the comment on EditorCommandHandler tests, it's a separate issue #4451. There's a pull request to fix it too. This pull request also breaks DocumentCommandHandler tests in the same fashion #4437 does. Applying #4448 fixes them (I observe only two failures while #4448 fixes three). |
Comment by busykai
|
Comment by RaymondLim
I'll be reviewing and running your unit tests soon. In the meantime, could you please sign up CLA here? |
Comment by adrocknaphobia
|
Comment by busykai Thank you |
Comment by RaymondLim Looks good. Merging. |
Issue by busykai
Thursday Jul 04, 2013 at 15:03 GMT
Originally opened as adobe/brackets#4379
Replaced usage of PathUtils (inappropriate for the task) with new FileUtils.getBaseName. JSDoc and unit tests included.
busykai included the following code: https://github.com/adobe/brackets/pull/4379/commits
The text was updated successfully, but these errors were encountered: