X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/395533868243ae2c0ab6052da2674f2e2d8cb79f..06b8558aaf911d643a7ab986dcc50d40f774d6b6:/app/controllers/api/amf_controller.rb diff --git a/app/controllers/api/amf_controller.rb b/app/controllers/api/amf_controller.rb index db8982d43..c903cc8e7 100644 --- a/app/controllers/api/amf_controller.rb +++ b/app/controllers/api/amf_controller.rb @@ -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)