Modified: trunk/app/models/workflow.rb (2114 => 2115)
--- trunk/app/models/workflow.rb 2009-03-06 15:29:04 UTC (rev 2114)
+++ trunk/app/models/workflow.rb 2009-03-06 15:58:46 UTC (rev 2115)
@@ -89,6 +89,7 @@
validates_inclusion_of :license, :in => [ "by-nd", "by-sa", "by" ]
+ validates_presence_of :content_blob
validates_presence_of :content_type
file_column :image, :magick => {
Modified: trunk/lib/rest.rb (2114 => 2115)
--- trunk/lib/rest.rb 2009-03-06 15:29:04 UTC (rev 2114)
+++ trunk/lib/rest.rb 2009-03-06 15:58:46 UTC (rev 2115)
@@ -525,12 +525,14 @@
workflow = Workflow.new(:contributor => user)
+ content = Base64.decode64(elements["content"]) if elements["content"]
+
workflow.title = elements["title"] if elements["title"]
workflow.body = elements["description"] if elements["description"]
workflow.license = elements["license_type"] if elements["license_type"]
workflow.content_type = elements["content_type"] if elements["content_type"]
- workflow.content_blob = ContentBlob.new(:data ="" Base64.decode64(elements["content"])) if elements["content"]
+ workflow.content_blob = ContentBlob.new(:data ="" content) if content
# Handle the preview and svg images. If there's a preview supplied, use it.
# Otherwise auto-generate one if we can.
@@ -548,7 +550,7 @@
image.close
- elsif workflow.processor_class and workflow.processor_class.can_generate_preview?
+ elsif content and workflow.processor_class and workflow.processor_class.can_generate_preview?
processor = workflow.processor_class.new(content)
workflow.image, workflow.svg = processor.get_preview_images