projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Streamer: Stream out Conversations/Participations.
[akkoma]
/
lib
/
pleroma
/
web
/
oauth.ex
diff --git
a/lib/pleroma/web/oauth.ex
b/lib/pleroma/web/oauth.ex
index 761b80fdeb451d365c928f7d65c7e136a8e3085f..d2835a0ba579c8a5c94b9a79736f07f9b48dd58a 100644
(file)
--- a/
lib/pleroma/web/oauth.ex
+++ b/
lib/pleroma/web/oauth.ex
@@
-3,22
+3,18
@@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth do
- def parse_scopes(
nil
) do
- nil
+ def parse_scopes(
scopes, _default) when is_list(scopes
) do
+ Enum.filter(scopes, &(&1 not in [nil, ""]))
end
end
- def parse_scopes(scopes
) when is_list
(scopes) do
+ def parse_scopes(scopes
, default) when is_binary
(scopes) do
scopes
scopes
+ |> String.trim()
+ |> String.split(~r/[\s,]+/)
+ |> parse_scopes(default)
end
end
- def parse_scopes(scopes) do
- scopes =
- scopes
- |> to_string()
- |> String.trim()
-
- if scopes == "",
- do: [],
- else: String.split(scopes, [" ", ","])
+ def parse_scopes(_, default) do
+ default
end
end
end
end