aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/oauth.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/oauth.ex')
-rw-r--r--lib/pleroma/web/oauth.ex19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/pleroma/web/oauth.ex b/lib/pleroma/web/oauth.ex
index 44b83433e..761b80fde 100644
--- a/lib/pleroma/web/oauth.ex
+++ b/lib/pleroma/web/oauth.ex
@@ -3,9 +3,22 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth do
- def parse_scopes(scopes) do
+ def parse_scopes(nil) do
+ nil
+ end
+
+ def parse_scopes(scopes) when is_list(scopes) do
scopes
- |> to_string()
- |> String.split([" ", ","])
+ end
+
+ def parse_scopes(scopes) do
+ scopes =
+ scopes
+ |> to_string()
+ |> String.trim()
+
+ if scopes == "",
+ do: [],
+ else: String.split(scopes, [" ", ","])
end
end