Skip to content

Commit b767d6c

Browse files
committed
支持当path指定起始位在最外层时使用缺省路径,也兼容全路径
1 parent d719a07 commit b767d6c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

APIJSON(Server)/src/main/java/zuo/biao/apijson/StringUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ public static boolean isPath(String path) {
359359
}
360360

361361
public static String[] splitPath(String path) {
362+
path = getString(path);
363+
if(path.startsWith("/")){
364+
path = path.substring(1);
365+
}
366+
if(path.endsWith("/")){
367+
path = path.substring(0, path.length() - 1);
368+
}
362369
return isPath(path) ? path.split(SEPARATOR) : new String[] {path};
363370
}
364371

0 commit comments

Comments
 (0)