ppkarwasz commented on code in PR #781:
URL: https://github.com/apache/commons-io/pull/781#discussion_r2330550220


##########
src/main/java/org/apache/commons/io/FileSystem.java:
##########
@@ -519,13 +528,11 @@ public boolean isLegalFileName(final CharSequence 
candidate) {
      * @since 2.21.0
      */
     public boolean isLegalFileName(final CharSequence candidate, final Charset 
charset) {
-        if (!isLegalFileLength(candidate, charset)) {
-            return false;
-        }
-        if (isReservedFileName(candidate)) {
-            return false;
-        }
-        return candidate.chars().noneMatch(this::isIllegalFileNameChar);
+        return candidate != null
+                && candidate.length() != 0
+                && nameLengthStrategy.isWithinLimit(candidate, 
getMaxFileNameLength(), charset)

Review Comment:
   I am not entirely sure, what are you suggesting? The `candidate` is passed 
to the strategy.
   
   Are you referring to the null check and `candidate.length() != 0`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to