X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d7c84d69bb62d61bc671b2d5e0ad4ed42dbeb7c0..3d878236c48e4856b5f58fdc2e6d35f8193e6150:/services/api/lib/safe_json.rb diff --git a/services/api/lib/safe_json.rb b/services/api/lib/safe_json.rb index dbf53e089b..f78a3d34dc 100644 --- a/services/api/lib/safe_json.rb +++ b/services/api/lib/safe_json.rb @@ -1,8 +1,18 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class SafeJSON def self.dump(o) return Oj.dump(o, mode: :compat) end def self.load(s) + if s.nil? or s == '' + # Oj 2.18.5 used to return nil. Not anymore on 3.6.4. + # Upgraded for performance issues (see #13803 and + # https://github.com/ohler55/oj/issues/441) + return nil + end Oj.strict_load(s, symbol_keys: false) end end