Detect file type if none given.
authoreal <eal@waifu.club>
Sun, 4 Feb 2018 13:14:08 +0000 (15:14 +0200)
committereal <eal@waifu.club>
Sun, 4 Feb 2018 13:22:30 +0000 (15:22 +0200)
lib/pleroma/upload.ex

index 3567c6c8893388c76e8a90d4c3a2136375ac6785..c41617c68e80fe4130f5d24a2990e7c93f216622 100644 (file)
@@ -9,7 +9,7 @@ defmodule Pleroma.Upload do
     File.cp!(file.path, result_file)
 
     # fix content type on some image uploads
-    content_type = if file.content_type == "application/octet-stream" do
+    content_type = if file.content_type in [nil, "application/octet-stream"] do
       get_content_type(file.path)
     else
       file.content_type