diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2023-08-11 11:44:13 +0000 |
---|---|---|
committer | marcin mikołajczak <me@mkljczk.pl> | 2023-08-11 11:44:13 +0000 |
commit | 049045cf2ac90dcca074be9b5cf2d8264828f834 (patch) | |
tree | 6ae15fb813fa0b917829a2a2976c44e94600e6e0 | |
parent | 4745a41393cddd9bbc5a14affa77595204488b8f (diff) | |
download | pleroma-049045cf2ac90dcca074be9b5cf2d8264828f834.tar.gz pleroma-049045cf2ac90dcca074be9b5cf2d8264828f834.zip |
Apply lanodan's suggestion
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 28553c35a..229e13504 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -494,20 +494,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do {:error, dgettext("errors", "Too many attachments")} end end - - def is_good_locale_code?(code) when is_binary(code) do - code - |> String.codepoints() - |> Enum.all?(&valid_char?/1) - end + def is_good_locale_code?(code) when is_binary(code), do: code =~ ~r<[A-zA-Z0-9\-]+> def is_good_locale_code?(_code), do: false - - # [a-zA-Z0-9-] - defp valid_char?(char) do - ("a" <= char and char <= "z") or - ("A" <= char and char <= "Z") or - ("0" <= char and char <= "9") or - char == "-" - end end |