Sfoglia il codice sorgente

BugFix: ensure not to allow templateTagData to be empty string

Yuki Takei 6 anni fa
parent
commit
4c511fda40

+ 1 - 1
src/client/js/services/PageContainer.js

@@ -41,7 +41,7 @@ export default class PageContainer extends Container {
       likerUserIds: [],
       likerUserIds: [],
 
 
       tags: [],
       tags: [],
-      templateTagData: mainContent.getAttribute('data-template-tags') || '',
+      templateTagData: mainContent.getAttribute('data-template-tags'),
 
 
       // latest(on remote) information
       // latest(on remote) information
       remoteRevisionId: revisionId,
       remoteRevisionId: revisionId,

+ 1 - 1
src/client/js/services/TagContainer.js

@@ -34,7 +34,7 @@ export default class TagContainer extends Container {
 
 
     const { pageId, templateTagData } = pageContainer.state;
     const { pageId, templateTagData } = pageContainer.state;
 
 
-    let tags;
+    let tags = [];
     // when the page exists
     // when the page exists
     if (pageId != null) {
     if (pageId != null) {
       const res = await this.appContainer.apiGet('/pages.getPageTag', { pageId });
       const res = await this.appContainer.apiGet('/pages.getPageTag', { pageId });

+ 3 - 1
src/server/views/widget/not_found_content.html

@@ -10,7 +10,9 @@
 <div id="content-main" class="content-main content-main-not-found page-list"
 <div id="content-main" class="content-main content-main-not-found page-list"
   data-path="{{ path | preventXss }}"
   data-path="{{ path | preventXss }}"
   data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
   data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
-  data-template-tags="{{ templateTags | '' }}"
+  {% if templateTags %}
+    data-template-tags="{{ templateTags }}"
+  {% endif %}
   >
   >
 
 
   {% include 'not_found_tabs.html' %}
   {% include 'not_found_tabs.html' %}