myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3697] branches/packs: added sanitize gem and str


From: noreply
Subject: [myexperiment-hackers] [3697] branches/packs: added sanitize gem and stripped tags from description annotations
Date: Tue, 10 Sep 2013 12:11:37 +0000 (UTC)

Revision
3697
Author
dgc
Date
2013-09-10 12:11:37 +0000 (Tue, 10 Sep 2013)

Log Message

added sanitize gem and stripped tags from description annotations

Modified Paths

Diff

Modified: branches/packs/Gemfile (3696 => 3697)


--- branches/packs/Gemfile	2013-09-10 10:53:41 UTC (rev 3696)
+++ branches/packs/Gemfile	2013-09-10 12:11:37 UTC (rev 3697)
@@ -31,4 +31,5 @@
 gem "simple-rss", "~> 1.2.3"
 gem "net-http-persistent", "~> 2.8"
 gem "wf4ever-transformation-client", "~> 0.3.0"
+gem "sanitize", "~> 2.0.6"
 

Modified: branches/packs/app/models/pack.rb (3696 => 3697)


--- branches/packs/app/models/pack.rb	2013-09-10 10:53:41 UTC (rev 3696)
+++ branches/packs/app/models/pack.rb	2013-09-10 12:11:37 UTC (rev 3697)
@@ -723,6 +723,8 @@
     description_annotation = research_object.annotations_of_type("description").first
     annotation_description = description_annotation[:parameters][:description].to_s if description_annotation
 
+    sanitized_description = Sanitize.clean(description)
+
     if title != annotation_title
 
       if annotation_title
@@ -746,7 +748,7 @@
           :creator_uri => "/users/#{user.id}")
     end
 
-    if description != annotation_description
+    if sanitized_description != annotation_description
 
       if annotation_description
         description_annotation[:annotation].ao_body.destroy
@@ -755,7 +757,7 @@
 
       parameters = {}
 
-      parameters[:description] = RDF::Literal(description)
+      parameters[:description] = RDF::Literal(sanitized_description)
       parameters[:resource]    = RDF::URI(research_object.uri)
 
       template = Conf.ro_templates["description"]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]