Commit ecac5773 authored by lain's avatar lain
Browse files

Transmogrifier: Only add context if it really is onne.

parent 51fc5047
Pipeline #24068 passed with stages
in 3 minutes and 45 seconds
......@@ -1255,14 +1255,11 @@ defp maybe_add_context_from_object(%{"context" => context} = data) when is_binar
do: {:ok, data}
defp maybe_add_context_from_object(%{"object" => object} = data) when is_binary(object) do
if object = Object.normalize(object) do
data =
data
|> Map.put("context", object.data["context"])
{:ok, data}
with %{data: %{"context" => context}} when is_binary(context) <- Object.normalize(object) do
{:ok, Map.put(data, "context", context)}
else
{:error, "No context on referenced object"}
_ ->
{:error, :no_context}
end
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment