Steven Fukase 4 tahun lalu
induk
melakukan
ab47e9d393
1 mengubah file dengan 13 tambahan dan 2 penghapusan
  1. 13 2
      src/client/js/components/PageCreateModal.jsx

+ 13 - 2
src/client/js/components/PageCreateModal.jsx

@@ -70,22 +70,33 @@ const PageCreateModal = (props) => {
     setTemplate(value);
   }
 
+  /**
+   * encode except slashes
+   */
+  function encodeExceptSlashes(path) {
+    return path
+      .split('/')
+      .map(item => encodeURIComponent(item))
+      .join('/');
+  }
   /**
    * access today page
    */
   function createTodayPage() {
     let tmpTodayInput1 = todayInput1;
+    const tmpTodayInput2 = encodeExceptSlashes(todayInput2);
     if (tmpTodayInput1 === '') {
       tmpTodayInput1 = t('Memo');
     }
-    window.location.href = encodeURI(urljoin(userPageRootPath, tmpTodayInput1, now, todayInput2, '#edit'));
+    tmpTodayInput1 = encodeExceptSlashes(tmpTodayInput1);
+    window.location.href = urljoin(userPageRootPath, tmpTodayInput1, now, tmpTodayInput2, '#edit');
   }
 
   /**
    * access input page
    */
   function createInputPage() {
-    window.location.href = encodeURI(urljoin(pageNameInput, '#edit'));
+    window.location.href = urljoin(encodeExceptSlashes(pageNameInput), '#edit');
   }
 
   function ppacInputChangeHandler(value) {