Skip to content

Commit

Permalink
Fix: Exception Operation on mixed SRID geometries (MultiPolygon, 4326…
Browse files Browse the repository at this point in the history
…) != (Point, 0)
  • Loading branch information
ro3t committed Dec 16, 2024
1 parent 0da56bb commit 3e8946f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def status_since
end

def district
District.find_by('ST_Contains(area, ?)', position)
District.find_by("ST_Contains(area, ST_GeomFromText('#{position}', 4326))", position)

Check warning

Code scanning / Brakeman

Possible SQL injection. Warning

Possible SQL injection.
end

def default_group_without_gui_access?
Expand Down
7 changes: 7 additions & 0 deletions test/models/issue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,11 @@ class IssueTest < ActiveSupport::TestCase
assert_not_nil Issue.trust_level_internal
end
end

test 'get district for issue position' do
assert_nothing_raised do
issue = issue(:received_two)
assert_equal district(:one), issue.district
end
end
end

0 comments on commit 3e8946f

Please sign in to comment.