You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a Work In Progress PR referring to original issue #13099
Before this PR can be landed, it would be nice to know which chars are actually invalid.
These are the chars that I'm invalidating:
\?
\\
\*
\.{2,} <-- .. or more should not be allowed, but allow .
\.$ <-- allow a file to have . but not end with .
\/
\|
\>
\<
I also have to add a unit test for this case.
Let me know if there are any chars that need to be added/removed.
@Simon66 I still have the same confusion regarding invalid character handling code. Part of the reason is the way file names get validated by the OS, it's quite different in case of windows and osx. Not sure whether we can have a common regex validator as that would limit the file naming capability in either of the platform.
What we can think about is, predominantly the projects being worked upon are web projects in Brackets. Eventually these files will be served and loaded in browser shells. What kind of restrictions do we have in the file names while serving them over network. Just thinking loud, may be not valid in this context.
@swmitra I think that no matter where this code lives (MacOS, Windows, Linux), those chars should be invalid. I'm not too sure why we should allow < or > on a linux env but not on Windows (Even though that char should be invalid on both OS.
But then again, which chars are invalid and which should not be.
I've changed the function isValidFilename to disallow any file name that contains folder structure (like tmp\file.log) and I created a new function to check if full pathname is valid. I've also added some test cases.
sdalmeida
changed the title
[WIP] Fix Issue 13099
Fix #13099: Disallow user to create files/folder using relative path
Apr 7, 2017
Hi @swmitra
I want to follow up on the status of this PR. I see that the code was approved but the PR is still open. There are many forked projects that might benefit from this bug fix 👍
Thanks :)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
5 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a Work In Progress PR referring to original issue #13099
Before this PR can be landed, it would be nice to know which chars are actually invalid.
These are the chars that I'm invalidating:
\?
\\
\*
\.{2,}
<-- .. or more should not be allowed, but allow .\.$
<-- allow a file to have . but not end with .\/
\|
\>
\<
I also have to add a unit test for this case.
Let me know if there are any chars that need to be added/removed.