diff options
author | kaniini <nenolod@gmail.com> | 2018-08-16 15:23:04 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2018-08-16 15:23:04 +0000 |
commit | f2fa09c50fde8db4e619872ef6121e90a69324a6 (patch) | |
tree | 4d34037c5fc6d1a3c05a0b061f5279caef1bd671 /test/upload_test.exs | |
parent | 718882b326f00c8315bca5acc439b92aa37bf021 (diff) | |
parent | 5fbb14f5ecbbd9feeed2a303c2619fbbba07d70e (diff) | |
download | pleroma-f2fa09c50fde8db4e619872ef6121e90a69324a6.tar.gz |
Merge branch 'develop' into 'patch-2'
# Conflicts:
# mix.exs
Diffstat (limited to 'test/upload_test.exs')
-rw-r--r-- | test/upload_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/upload_test.exs b/test/upload_test.exs index 09aa5e068..d273ea5f6 100644 --- a/test/upload_test.exs +++ b/test/upload_test.exs @@ -56,5 +56,31 @@ defmodule Pleroma.UploadTest do data = Upload.store(file, false) assert data["name"] == "an [image.jpg" end + + test "fixes incorrect file extension" do + File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") + + file = %Plug.Upload{ + content_type: "image/jpg", + path: Path.absname("test/fixtures/image_tmp.jpg"), + filename: "an [image.blah" + } + + data = Upload.store(file, false) + assert data["name"] == "an [image.jpg" + end + + test "don't modify filename of an unknown type" do + File.cp("test/fixtures/test.txt", "test/fixtures/test_tmp.txt") + + file = %Plug.Upload{ + content_type: "text/plain", + path: Path.absname("test/fixtures/test_tmp.txt"), + filename: "test.txt" + } + + data = Upload.store(file, false) + assert data["name"] == "test.txt" + end end end |