projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set log level to debug for not important messages
[akkoma]
/
lib
/
pleroma
/
web
/
media_proxy
/
media_proxy_controller.ex
diff --git
a/lib/pleroma/web/media_proxy/media_proxy_controller.ex
b/lib/pleroma/web/media_proxy/media_proxy_controller.ex
index 1e9520d462c36fc29da22698e87fc533db0f237b..8403850ff1ca9b7c2f9ee9c56ffe93bab3f666a5 100644
(file)
--- a/
lib/pleroma/web/media_proxy/media_proxy_controller.ex
+++ b/
lib/pleroma/web/media_proxy/media_proxy_controller.ex
@@
-30,7
+30,7
@@
defmodule Pleroma.Web.MediaProxy.MediaProxyController do
def filename_matches(%{"filename" => _} = _, path, url) do
filename = MediaProxy.filename(url)
def filename_matches(%{"filename" => _} = _, path, url) do
filename = MediaProxy.filename(url)
- if filename &&
Path.basename(path) != filename
do
+ if filename &&
does_not_match(path, filename)
do
{:wrong_filename, filename}
else
:ok
{:wrong_filename, filename}
else
:ok
@@
-38,4
+38,9
@@
defmodule Pleroma.Web.MediaProxy.MediaProxyController do
end
def filename_matches(_, _, _), do: :ok
end
def filename_matches(_, _, _), do: :ok
+
+ defp does_not_match(path, filename) do
+ basename = Path.basename(path)
+ basename != filename and URI.decode(basename) != filename and URI.encode(basename) != filename
+ end
end
end