Steven Fukase 4 лет назад
Родитель
Сommit
83b2539f9f
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      packages/growi-commons/src/util/path-utils.js

+ 7 - 1
packages/growi-commons/src/util/path-utils.js

@@ -17,7 +17,10 @@ function matchSlashes(path) {
  * @returns {boolean}
  * @memberof pathUtils
  */
-function hasHeadingSlash(path) {
+ function hasHeadingSlash(path) {
+  if (path == null || path === '') {
+    return false;
+  }
   const match = matchSlashes(path);
   return (match[2] != null);
 }
@@ -29,6 +32,9 @@ function hasHeadingSlash(path) {
  * @memberof pathUtils
  */
 function hasTrailingSlash(path) {
+  if (path == null || path === '') {
+    return false;
+  }
   const match = matchSlashes(path);
   return (match[4] != null);
 }