-
Notifications
You must be signed in to change notification settings - Fork 702
Amend description to reflect empty string result for windows drive #552
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
base: master
Are you sure you want to change the base?
Conversation
|
You've pointed to existing bad API design. getFullPathNoEndSeparator("C:") should return "" if the argument is a Unix path and "C:" if that path is a Windows path. Of course, it's just a string, and we have no way of knowing whether that's a Windows path or a Posix path. In this case, best guess is Windows since "C:" is very common in Windows and very uncommon on Unix, but it's still a guess. Possibly we should deprecate this method and rethink the API here. |
@elharo Agreed. For the time being, any objection merging this PR to bring the JavaDoc inline with the method's actual behavior? |
|
` import org.apache.commons.lang3.Validate; public class PathValidator { }` @garydgregory can we make some code in apache commons to avoid path-injection attacks like the code above for aavoiding path injections in windows? |
|
@elharo pls see the above message |
|
Apache Commons IO already provides utilities to guard against path-traversal and invalid names:
One note: |
Not sure if this is is a bug or a feature – what i can confirm is that in v2.4 it worked as it said in the description:
After upgrading to 2.15.1, i realized my test suite failed, the behaviour is now:
This PR proposes to reflect this change in the javadoc.