Marisa Strong avatar Marisa Strong committed 669e763

fix bug #126 problem with exporting plans related to CGI issues. using HTMLEntities gem instead

Comments (0)

Files changed (4)

 gem 'wkhtmltopdf-binary'
 gem 'wicked_pdf' #gem install wicked_pdf
 gem 'uuidtools'
+gem 'htmlentities'
 
 #
 # Development Mode Gems
       multipart-post (~> 1.1.0)
       rack (>= 1.1.0, < 2)
     gravatar_image_tag (1.0.0.pre2)
+    htmlentities (4.3.1)
     i18n (0.5.0)
     json (1.7.5)
     linecache19 (0.5.12)
   annotate (= 2.4.0)
   factory_girl_rails (= 1.0)
   gravatar_image_tag (= 1.0.0.pre2)
+  htmlentities
   mysql2 (< 0.3)
   net-ldap
   omniauth (~> 0.2.6)

app/controllers/plans_controller.rb

 Mime::Type.register 'application/rtf', :rtf 
+require 'htmlentities'
+
 class PlansController < ApplicationController
   respond_to :html, :text
 
     #require_plan
     #@plan = Plan.find(params[:id]) #obsolete by require_plan above
     filename = @plan.name
+    @coder = HTMLEntities.new
     respond_with(@plan) do |format|
       format.html { render :layout => 'minimal'}
       format.text {

app/views/plans/show.txt.erb

 <%=strip_tags("#{qa.number}. #{qa.question_brief}")%>
 
 <%plainText=strip_tags(qa.answer)%>
-<% require 'cgi'%>
-<%= CGI.unescapeHTML(plainText)%>
+<%= @coder.decode(plainText)%>
 
 <% end %>
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.