diff options
author | kaniini <nenolod@gmail.com> | 2018-08-26 21:06:15 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2018-08-26 21:06:15 +0000 |
commit | 0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8 (patch) | |
tree | 45a693814a7f1f7bd2d6108732f2b75086f1fa0a /test/upload_test.exs | |
parent | 30261772063a30ca0ef299f441cfed4630ffb630 (diff) | |
parent | 3448b434f54e8b4749524e3ccd876359a6501845 (diff) | |
download | pleroma-0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8.tar.gz pleroma-0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8.zip |
Merge branch 'develop' into 'feature/relay'
# Conflicts:
# lib/pleroma/web/activity_pub/utils.ex
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 |