]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/amf_controller.rb
Merge remote-tracking branch 'upstream/pull/2806'
[rails.git] / app / controllers / api / amf_controller.rb
index db8982d43278237df950f2889b5078b84aef69f2..c903cc8e73698b3b36106db31e7a0fa69a3779b0 100644 (file)
@@ -87,7 +87,7 @@ module Api
           result = [-5, nil]
         else
           case message
-          when "putway" then
+          when "putway"
             orn = renumberednodes.dup
             result = putway(renumberednodes, *args)
             result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
@@ -96,7 +96,7 @@ module Api
             result = putrelation(renumberednodes, renumberedways, *args)
           when "deleteway"
             result = deleteway(*args)
-          when "putpoi" then
+          when "putpoi"
             result = putpoi(*args)
             renumberednodes[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
           when "startchangeset"
@@ -128,11 +128,9 @@ module Api
       [-2, "An unusual error happened (in #{call}). The server said: #{e}"]
     end
 
-    def amf_handle_error_with_timeout(call, rootobj, rootid)
+    def amf_handle_error_with_timeout(call, rootobj, rootid, &block)
       amf_handle_error(call, rootobj, rootid) do
-        OSM::Timer.timeout(Settings.api_timeout, OSM::APITimeoutError) do
-          yield
-        end
+        OSM::Timer.timeout(Settings.api_timeout, OSM::APITimeoutError, &block)
       end
     end
 
@@ -868,7 +866,7 @@ module Api
     # not just the id, hence this abstraction
 
     def getuser(token)
-      if token =~ /^(.+)\:(.+)$/
+      if token =~ /^(.+):(.+)$/
         User.authenticate(:username => Regexp.last_match(1), :password => Regexp.last_match(2))
       else
         User.authenticate(:token => token)