-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix to prevent moving files by renaming files using FileTreeView #11862
Conversation
tallandroid
commented
Oct 28, 2015
- Added / to be an invalid file name character for mac platform
- Return baseName to include ../ if the fullpath contains ../
2) Return baseName to include ../ if the fullpath contains ../
However, it's only a partial fix for all the issues listed in #11609. It solves the main one, but the others still remain. Some tests cases that should fail:
|
The fix covers the cases like : hello/world.js and helloworld.js/ are already covered by appshell rename validation logic. /helloworld.js is already covered. |
@tallandroid yeah, this PR does fix the original issue that #11609 so maybe the other things I mentioned are out of the scope for this PR (albeit related to my original issue #11609 (comment)). Which platform are you on? At least on Windows the validation fails with ➡️ folder Let's create a folder and try that again it actually created the other file too (like one could except if relative paths would be valid (The foo/bar.js file opens the correct file too, so there's that). Similar things can be done with things like creating folders by naming a file with ending slash et cetera and it can be abused to infinity. That's why I think it's important that the fix would apply to all the cases regarding |
2) Fixed the file rename logic to validate against the newName against base name
I get your point. I think it makes more sense to weed out validation against base name completely. That is the safest path to go. I have updated the PR. I would appreciate if you can validate it on windows platform. I verified the use cases on mac platform. |
Works great for renaming old files on Windows 👍 However, creating a new file and renaming that instantly skips Check out this if-clause brackets/src/project/ProjectModel.js Line 959 in d939740
createAtPath that it uses to create the file: brackets/src/project/ProjectModel.js Line 992 in d939740
|
I intentionally left out createAtPath workflow as I believe its out of the scope of this PR. I completely understand the workflow mentioned above but I am skeptical of this being called a bug or not. Couple of reasons :
I would prefer discussing that over the group once and once confirmed , I myself am willing to make that change too :) |
Yeah, I am okay with this PR focusing on the renaming files part too 👍 ping @peterflynn @abose @nethip @humphd |
Ping. I am not sure abt the turnaround time. |
Sorry for the late response . |
@abose I think it's ready to be merged, the other related issues can be (and should be) fixed and tracked separately. |
@abose is this done ? Let me know if you are waiting on something. |
Thanks @tallandroid . |
Ping ? |
Reviewed and merged (as it should have been a while ago). |
Thanks @zaggino and especially @tallandroid for your patience! |