Fix error when attempting to convert image w/o Content-Type header to data URI
This commit is contained in:
parent
3bbf42df75
commit
8e18a415eb
|
@ -144,12 +144,12 @@ defmodule Frenzy.Pipeline.ScrapeStage do
|
|||
|
||||
case Network.http_get(absolute_url) do
|
||||
{:ok, %Mojito.Response{body: body, headers: headers}} ->
|
||||
{"Content-Type", content_type} =
|
||||
Enum.find(headers, fn {header, _value} -> header == "Content-Type" end)
|
||||
|
||||
if content_type in @content_type_allowlist do
|
||||
|> case do
|
||||
{"Content-Type", content_type} when content_type in @content_type_allowlist ->
|
||||
"data:#{content_type};base64,#{Base.encode64(body)}"
|
||||
else
|
||||
|
||||
_ ->
|
||||
src
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue