Skip to content

Commit 7ae9ca5

Browse files
authored
Revert "[Improvement] Abnormal characters check (apache#15824)" (apache#16102)
This reverts commit e5e7749.
1 parent 3bc88e3 commit 7ae9ca5

File tree

4 files changed

+0
-40
lines changed

4 files changed

+0
-40
lines changed

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java

-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.dolphinscheduler.api.service.impl;
1919

20-
import static org.apache.dolphinscheduler.api.utils.CheckUtils.checkFilePath;
2120
import static org.apache.dolphinscheduler.common.constants.Constants.ALIAS;
2221
import static org.apache.dolphinscheduler.common.constants.Constants.CONTENT;
2322
import static org.apache.dolphinscheduler.common.constants.Constants.EMPTY_STRING;
@@ -1291,10 +1290,6 @@ private void checkFullName(String userTenantCode, String fullName) {
12911290
if (FOLDER_SEPARATOR.equalsIgnoreCase(fullName)) {
12921291
return;
12931292
}
1294-
// abnormal characters check
1295-
if (!checkFilePath(fullName)) {
1296-
throw new ServiceException(Status.ILLEGAL_RESOURCE_PATH);
1297-
}
12981293
// Avoid returning to the parent directory
12991294
if (fullName.contains("../")) {
13001295
throw new ServiceException(Status.ILLEGAL_RESOURCE_PATH, fullName);

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/CheckUtils.java

-10
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,4 @@ private static boolean regexChecks(String str, Pattern pattern) {
158158

159159
return pattern.matcher(str).matches();
160160
}
161-
162-
/**
163-
* regex FilePath check,only use a to z, A to Z, 0 to 9, and _./-
164-
*
165-
* @param str input string
166-
* @return true if regex pattern is right, otherwise return false
167-
*/
168-
public static boolean checkFilePath(String str) {
169-
return regexChecks(str, Constants.REGEX_FILE_PATH);
170-
}
171161
}

dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java

-20
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,4 @@ public void testCheckPhone() {
9292
Assertions.assertTrue(CheckUtils.checkPhone("17362537263"));
9393
}
9494

95-
/**
96-
* check file path
97-
*/
98-
@Test
99-
public void testCheckFilePath() {
100-
// true
101-
Assertions.assertTrue(CheckUtils.checkFilePath("/"));
102-
Assertions.assertTrue(CheckUtils.checkFilePath("xx/"));
103-
Assertions.assertTrue(CheckUtils.checkFilePath("/xx"));
104-
Assertions.assertTrue(CheckUtils.checkFilePath("14567134578654"));
105-
Assertions.assertTrue(CheckUtils.checkFilePath("/admin/root/"));
106-
Assertions.assertTrue(CheckUtils.checkFilePath("/admin/root/1531531..13513/153135.."));
107-
// false
108-
Assertions.assertFalse(CheckUtils.checkFilePath(null));
109-
Assertions.assertFalse(CheckUtils.checkFilePath("file://xxx/ss"));
110-
Assertions.assertFalse(CheckUtils.checkFilePath("/xxx/ss;/dasd/123"));
111-
Assertions.assertFalse(CheckUtils.checkFilePath("/xxx/ss && /dasd/123"));
112-
Assertions.assertFalse(CheckUtils.checkFilePath("/xxx/ss || /dasd/123"));
113-
}
114-
11595
}

dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/Constants.java

-5
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ private Constants() {
249249
*/
250250
public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$");
251251

252-
/**
253-
* file path regex
254-
*/
255-
public static final Pattern REGEX_FILE_PATH = Pattern.compile("^[a-zA-Z0-9_./-]+$");
256-
257252
/**
258253
* read permission
259254
*/

0 commit comments

Comments
 (0)