X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/7fef0353f25ecb02d400987ec30763d1ce881a12..6910434fe0f3c662c0a6e491613fe9171ec627da:/app/controllers/changeset_controller.rb diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index a2efdce7b..31004e8ee 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -15,6 +15,7 @@ class ChangesetController < ApplicationController before_action :check_api_readable, :except => [:create, :update, :delete, :upload, :download, :query, :list, :feed, :comment, :subscribe, :unsubscribe, :comments_feed] before_action(:only => [:list, :feed, :comments_feed]) { |c| c.check_database_readable(true) } around_action :api_call_handle_error, :except => [:list, :feed, :comments_feed] + around_action :api_call_timeout, :except => [:list, :feed, :comments_feed, :upload] around_action :web_timeout, :only => [:list, :feed, :comments_feed] # Helper methods for checking consistency @@ -95,8 +96,10 @@ class ChangesetController < ApplicationController lat << cs.max_lat unless cs.max_lat.nil? # collapse the arrays to minimum and maximum - cs.min_lon, cs.min_lat, cs.max_lon, cs.max_lat = - lon.min, lat.min, lon.max, lat.max + cs.min_lon = lon.min + cs.min_lat = lat.min + cs.max_lon = lon.max + cs.max_lat = lat.max # save the larger bounding box and return the changeset, which # will include the bigger bounding box. @@ -241,13 +244,9 @@ class ChangesetController < ApplicationController changeset = Changeset.find(params[:id]) new_changeset = Changeset.from_xml(request.raw_post) - if new_changeset.nil? - render :text => "", :status => :bad_request - else - check_changeset_consistency(changeset, @user) - changeset.update_from(new_changeset, @user) - render :text => changeset.to_xml, :mime_type => "text/xml" - end + check_changeset_consistency(changeset, @user) + changeset.update_from(new_changeset, @user) + render :text => changeset.to_xml, :mime_type => "text/xml" end ## @@ -442,6 +441,8 @@ class ChangesetController < ApplicationController respond_to do |format| format.rss end + rescue OSM::APIBadUserInput + render :text => "", :status => :bad_request end private