Fix sentry errors in old carto module

This commit is contained in:
Paul Chavard 2018-10-22 15:37:47 +02:00
parent f75d890a1f
commit e5d8d351ba
2 changed files with 8 additions and 4 deletions

View file

@ -65,9 +65,13 @@ class Users::CarteController < UsersController
# https://tools.ietf.org/html/rfc7946#section-3.1.6
if json_latlngs.present?
multipolygone = JSON.parse(json_latlngs)
multipolygone.reject! { |polygone| polygone.count < 4 }
if multipolygone.present?
multipolygone.to_json
if multipolygone.first == ["error", "TooManyPolygons"]
[].to_json
else
multipolygone.reject! { |polygone| polygone.count < 4 }
if multipolygone.present?
multipolygone.to_json
end
end
end
end