Amend description to reflect empty string result for windows drive#552
Amend description to reflect empty string result for windows drive#552Philzen wants to merge 1 commit intoapache:masterfrom
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.