You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/02/07 18:49:37 UTC

[GitHub] [commons-net] sebbASF commented on a change in pull request #95: NET-707: Process files with spaces in name for OS400

sebbASF commented on a change in pull request #95:
URL: https://github.com/apache/commons-net/pull/95#discussion_r800957519



##########
File path: src/main/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParser.java
##########
@@ -243,7 +243,7 @@
         + "(?:(\\d+)\\s+)?"           // size, empty for members
         + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members
         + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+"  // *STMF/*DIR/*FILE/*MEM
-        + "(?:(\\S+)\\s*)?";          // file name, missing, when CWD is a *FILE
+        + "(((\\S+)\\s*)+)?";           // file name, missing, when CWD is a *FILE

Review comment:
       If you have direct access to the OS, you could try creating a name with a leading space, and see how it appears in FTP.
   You may need to escape or quote the space. Similarly with FTP, it's possible that the client drops leading spaces.
   
   "(((\\S+)\\s*)+)?"
   could be expressed as
   "((\\S+\\s*)+)?"
   unless you need to refer to the non-space matches separately.
   
   Unless trailing spaces need to be trimmed, it can be further simplified to:
   "(.*)?"
   because leading spaces have already been removed.




-- 
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-unsubscribe@commons.apache.org

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