Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
43d5e4f7
Verified
Commit
43d5e4f7
authored
Dec 02, 2018
by
href
Browse files
Fix media proxy config defaults
parent
ca24ad2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/media_proxy/controller.ex
View file @
43d5e4f7
...
...
@@ -5,12 +5,12 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyController do
@default_proxy_opts
[
max_body_length:
25
*
1_048_576
]
def
remote
(
conn
,
params
=
%{
"sig"
=>
sig64
,
"url"
=>
url64
})
do
with
config
<-
Pleroma
.
Config
.
get
([
:media_proxy
]),
with
config
<-
Pleroma
.
Config
.
get
([
:media_proxy
]
,
[]
),
true
<-
Keyword
.
get
(
config
,
:enabled
,
false
),
{
:ok
,
url
}
<-
MediaProxy
.
decode_url
(
sig64
,
url64
),
filename
<-
Path
.
basename
(
URI
.
parse
(
url
)
.
path
),
:ok
<-
filename_matches
(
Map
.
has_key?
(
params
,
"filename"
),
conn
.
request_path
,
url
)
do
ReverseProxy
.
call
(
conn
,
url
,
Keyword
.
get
(
config
,
:proxy_opts
,
@default_proxy_
length
))
ReverseProxy
.
call
(
conn
,
url
,
Keyword
.
get
(
config
,
:proxy_opts
,
@default_proxy_
opts
))
else
false
->
send_resp
(
conn
,
404
,
Plug
.
Conn
.
Status
.
reason_phrase
(
404
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment