Modified: branches/components/lib/rest.rb (3229 => 3230)
--- branches/components/lib/rest.rb 2012-12-05 16:37:56 UTC (rev 3229)
+++ branches/components/lib/rest.rb 2012-12-06 10:32:01 UTC (rev 3230)
@@ -1320,7 +1320,18 @@
case action
when 'create':
return rest_response(401, :reason => "Not authorised to create a pack") unless Authorization.check('create', Pack, opts[:user], nil)
- ob = Pack.new(:contributor => opts[:user])
+ if id = opts[:query]['id']
+ ob = Pack.find_by_id(id)
+ if ob.nil?
+ return rest_response(404, :reason => "Couldn't find a Pack with id #{id}")
+ else
+ ob.snapshot!
+ return rest_get_request(ob, opts[:user], { "id" => ob.id.to_s })
+ end
+ else
+ ob = Pack.new(:contributor => opts[:user])
+ end
+
when 'view', 'edit', 'destroy':
ob, error = obtain_rest_resource('Pack', opts[:query]['id'], opts[:query]['version'], opts[:user], action)
else