Merge pull request #2887 from tchak/fix-old-carto
Fix sentry errors in old carto module
This commit is contained in:
commit
744117537b
2 changed files with 8 additions and 4 deletions
|
@ -65,6 +65,9 @@ class Users::CarteController < UsersController
|
|||
# https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||
if json_latlngs.present?
|
||||
multipolygone = JSON.parse(json_latlngs)
|
||||
if multipolygone.first == ["error", "TooManyPolygons"]
|
||||
[].to_json
|
||||
else
|
||||
multipolygone.reject! { |polygone| polygone.count < 4 }
|
||||
if multipolygone.present?
|
||||
multipolygone.to_json
|
||||
|
@ -72,3 +75,4 @@ class Users::CarteController < UsersController
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -91,7 +91,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def ensure_safe_json(json)
|
||||
JSON.parse(json).to_json
|
||||
json.present? ? JSON.parse(json).to_json : '[]'
|
||||
rescue Exception => e
|
||||
Raven.capture_exception(e)
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue