Przeglądaj źródła

Merge pull request #1021 from weseek/fix/hostnamestripped

bug fix
Yuki Takei 6 lat temu
rodzic
commit
fd45522c57

+ 4 - 0
src/server/util/middlewares.js

@@ -150,6 +150,10 @@ exports.swigFilters = function(crowi, app, swig) {
       return pathUtils.removeTrailingSlash(string);
     });
 
+    swig.setFilter('addTrailingSlash', (string) => {
+      return pathUtils.addTrailingSlash(string);
+    });
+
     swig.setFilter('presentation', (string) => {
       // 手抜き
       return string

+ 2 - 1
src/server/views/modal/create_page.html

@@ -72,7 +72,8 @@
             // modify href
             const value = $(this).val();
             const pageName = (value === 'children') ? '_template' : '__template';
-            const link = '{{ page.path || path }}/' + pageName + '#edit-form';
+            const truePath = "{{ page.path || path | addTrailingSlash }}";
+            const link = truePath + pageName + '#edit-form';
             $('#link-to-template').attr('href', link);
           });
         </script>