Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `page' for nil:NilClass #12

Open
eddybeyond opened this issue Sep 22, 2018 · 1 comment
Open

undefined method `page' for nil:NilClass #12

eddybeyond opened this issue Sep 22, 2018 · 1 comment

Comments

@eddybeyond
Copy link


{{html
       
  • option 1
  •    
  • option 2
  •    
  • option 3
}}

Error executing the html macro (undefined method `page' for nil:NilClass)

@tonosaman
Copy link

remove page.protected check from macros.

diff --git a/init.rb b/init.rb
index df6879b..19a1184 100644
--- a/init.rb
+++ b/init.rb
@@ -14,88 +14,42 @@ Redmine::Plugin.register :redmine_wiki_html_util do
   Redmine::WikiFormatting::Macros.register do
     desc "Embed raw html\nUsage:\n<pre>{{html\nHTML CODE\n}}</pre>"
     macro :html, :parse_args => false do |obj, args, text|
-      page = obj.page
-      raise 'Page not found' if page.nil?
-
-      # For security, only allow insertion on protected (locked) wiki pages
-      if page.protected
-        content = text || args
-        result = "#{ CGI::unescapeHTML(content) }".html_safe
-       return result
-      else
-        return "<!-- Macro removed due to wiki page being unprotected -->"
-      end
-    end
+      content = text || args
+      return "#{ CGI::unescapeHTML(content) }".html_safe
+    end
   end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants