Remove check for File.fileSeparatorChar from MKD command. Will fail incorrectly on custom file systems, and will disallow creation of directories which the OS allows in some cases (FTPSERVER-348)
git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@917039 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/ftpserver/command/impl/MKD.java b/core/src/main/java/org/apache/ftpserver/command/impl/MKD.java
index 40d6115..19c118d 100644
--- a/core/src/main/java/org/apache/ftpserver/command/impl/MKD.java
+++ b/core/src/main/java/org/apache/ftpserver/command/impl/MKD.java
@@ -61,10 +61,7 @@
// argument check
String fileName = request.getArgument();
- //TODO perhaps we do not need to check if the given argument contains
- //path separator. Windows allows to create a dir like "a;b". Why should
- //we restrict creation of such a folder?
- if (fileName == null || fileName.indexOf(File.pathSeparatorChar) > -1) {
+ if (fileName == null) {
session.write(LocalizedFileActionFtpReply.translate(session, request, context,
FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
"MKD", null, null));
diff --git a/core/src/test/java/org/apache/ftpserver/clienttests/DirectoryTest.java b/core/src/test/java/org/apache/ftpserver/clienttests/DirectoryTest.java
index a062578..976b8c7 100644
--- a/core/src/test/java/org/apache/ftpserver/clienttests/DirectoryTest.java
+++ b/core/src/test/java/org/apache/ftpserver/clienttests/DirectoryTest.java
@@ -57,10 +57,6 @@
assertEquals(501, client.sendCommand("MKD"));
}
- public void testMkdirInValidDirectoryName() throws Exception {
- assertEquals(501, client.sendCommand("MKD foo:bar;foo"));
- }
-
/**
* FTPSERVER-233, we should not recursively create directories
*/