Convert mix of JSON.parse and JSON.load_file (#38242)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2026-03-17 13:27:57 +00:00
1 parent 4d33490ec8
commit b9d25bde3e
9 files changed
+18 -18

No files matched your search

+2 -2
View File
@@ -86,14 +86,14 @@ class FetchOEmbedService
end
validate(parse_for_format(body)) if body.present?
rescue Oj::ParseError, Ox::ParseError
rescue JSON::ParserError, Ox::ParseError
nil
end
def parse_for_format(body)
case @format
when :json
Oj.load(body, mode: :strict)&.with_indifferent_access
JSON.parse(body)&.with_indifferent_access
when :xml
Ox.load(body, mode: :hash_no_attrs)&.with_indifferent_access&.dig(:oembed)
end