Skip to content

Commit

Permalink
Handle more edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
miharekar committed Dec 20, 2024
1 parent 718a22c commit 8805879
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/parsers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.parse_json(file, retrying: false)
Appsignal.set_message("JSON parsing failed for #{s3_response.etag}")
raise
else
file = file.delete("\n")
file = file.gsub(/[\u0000-\u001F\u007F-\u009F]/, "")
retrying = true
retry
end
Expand Down
1 change: 1 addition & 0 deletions test/files/invalid_profile_3.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test/models/parsers/decent_json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def new_shot(path, user: @user)
assert_equal 237, shot.information.timeframe.size
end

test "handles even more even more invalid profile string" do
shot = new_shot("test/files/invalid_profile_3.json")
assert shot.valid?
assert_equal "Flow profile for milky drinks", shot.profile_title
assert_equal 105, shot.information.timeframe.size
end

test "handles invalid settings" do
shot = new_shot("test/files/invalid_settings.json")
assert shot.valid?
Expand Down

0 comments on commit 8805879

Please sign in to comment.