Skip to content
GitLab
Menu
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
4263edc9
Commit
4263edc9
authored
Mar 05, 2019
by
rinpatch
Browse files
Properly escape reserved URI charachters in upload urls
parent
10248d86
Pipeline
#8597
passed with stages
in 4 minutes and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/upload.ex
View file @
4263edc9
...
...
@@ -85,6 +85,10 @@ def store(upload, opts \\ []) do
end
end
def
char_unescaped?
(
char
)
do
URI
.
char_unreserved?
(
char
)
or
char
==
?/
end
defp
get_opts
(
opts
)
do
{
size_limit
,
activity_type
}
=
case
Keyword
.
get
(
opts
,
:type
)
do
...
...
@@ -218,9 +222,7 @@ defp tempfile_for_image(data) do
defp
url_from_spec
(
base_url
,
{
:file
,
path
})
do
path
=
path
|>
URI
.
encode
()
|>
String
.
replace
(
"?"
,
"%3F"
)
|>
String
.
replace
(
":"
,
"%3A"
)
|>
URI
.
encode
(
&
char_unescaped?
/
1
)
[
base_url
,
"media"
,
path
]
|>
Path
.
join
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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