don't try to truncate non-strings
This commit is contained in:
parent
2975da284b
commit
cb99cfcc65
1 changed files with 1 additions and 1 deletions
|
@ -175,7 +175,7 @@ def following_count(%User{} = user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp truncate_if_exists(params, key, max_length) do
|
defp truncate_if_exists(params, key, max_length) do
|
||||||
if Map.has_key?(params, key) do
|
if Map.has_key?(params, key) and is_binary(params[key]) do
|
||||||
{value, _chopped} = String.split_at(params[key], max_length)
|
{value, _chopped} = String.split_at(params[key], max_length)
|
||||||
Map.put(params, key, value)
|
Map.put(params, key, value)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue