myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3246] branches/components/lib/rest.rb: Added fil


From: noreply
Subject: [myexperiment-hackers] [3246] branches/components/lib/rest.rb: Added filename to file upload in API
Date: Mon, 10 Dec 2012 14:31:35 +0000 (UTC)

Revision
3246
Author
fbacall
Date
2012-12-10 14:31:35 +0000 (Mon, 10 Dec 2012)

Log Message

Added filename to file upload in API

Modified Paths

Diff

Modified: branches/components/lib/rest.rb (3245 => 3246)


--- branches/components/lib/rest.rb	2012-12-10 10:47:28 UTC (rev 3245)
+++ branches/components/lib/rest.rb	2012-12-10 14:31:35 UTC (rev 3246)
@@ -1220,6 +1220,7 @@
     description      = parse_element(data, :text,   '/file/description')
     license_type     = parse_element(data, :text,   '/file/license-type')
     type             = parse_element(data, :text,   '/file/type')
+    filename         = parse_element(data, :text,   '/file/filename')
     content_type     = parse_element(data, :text,   '/file/content-type')
     content          = parse_element(data, :binary, '/file/content')
     revision_comment = parse_element(data, :text,   '/file/revision-comment')
@@ -1243,6 +1244,15 @@
         end
       end
     end
+
+    # file name
+
+    if filename && !filename.blank?
+      ob.local_name = filename
+    else
+      ob.errors.add("Filename", "missing")
+      return rest_response(400, :object => ob)
+    end
    
     # handle type
 

reply via email to

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