projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma]
/
lib
/
pleroma
/
web
/
rich_media
/
parser.ex
diff --git
a/lib/pleroma/web/rich_media/parser.ex
b/lib/pleroma/web/rich_media/parser.ex
index 38f1cdeecb5c83ded6d18ca0357cd92700d8d896..21cd47890abc8a17fa583241cdd8f970a91d3be4 100644
(file)
--- a/
lib/pleroma/web/rich_media/parser.ex
+++ b/
lib/pleroma/web/rich_media/parser.ex
@@
-9,9
+9,16
@@
defmodule Pleroma.Web.RichMedia.Parser do
Pleroma.Web.RichMedia.Parsers.OEmbed
]
Pleroma.Web.RichMedia.Parsers.OEmbed
]
+ @hackney_options [
+ pool: :media,
+ recv_timeout: 2_000,
+ max_body: 2_000_000,
+ with_body: true
+ ]
+
def parse(nil), do: {:error, "No URL provided"}
def parse(nil), do: {:error, "No URL provided"}
- if
Mix.env(
) == :test do
+ if
Pleroma.Config.get(:env
) == :test do
def parse(url), do: parse_url(url)
else
def parse(url) do
def parse(url), do: parse_url(url)
else
def parse(url) do
@@
-28,9
+35,12
@@
defmodule Pleroma.Web.RichMedia.Parser do
defp parse_url(url) do
try do
defp parse_url(url) do
try do
- {:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url, [], adapter:
[pool: :media]
)
+ {:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url, [], adapter:
@hackney_options
)
- html |> maybe_parse() |> clean_parsed_data() |> check_parsed_data()
+ html
+ |> maybe_parse()
+ |> clean_parsed_data()
+ |> check_parsed_data()
rescue
e ->
{:error, "Parsing error: #{inspect(e)}"}
rescue
e ->
{:error, "Parsing error: #{inspect(e)}"}