Add Theora detection to upload.ex
authorrinpatch <rinpatch@sdf.org>
Tue, 27 Nov 2018 11:34:29 +0000 (14:34 +0300)
committerrinpatch <rinpatch@airmail.cc>
Tue, 27 Nov 2018 14:51:02 +0000 (17:51 +0300)
lib/pleroma/upload.ex

index 89aa779f93e153f700953f6374cf3b4903e642f0..9dcd9987afdd7a47299f949d6b2ccc62b25ee61e 100644 (file)
@@ -162,7 +162,12 @@ defmodule Pleroma.Upload do
             "audio/mpeg"
 
           <<0x4F, 0x67, 0x67, 0x53, 0x00, 0x02, 0x00, 0x00>> ->
-            "audio/ogg"
+            case IO.binread(f, 27) do
+              <<_::size(160), 0x80, 0x74,0x68,0x65,0x6f,0x72,0x61>> ->
+                "video/ogg"
+              _ ->
+                "audio/ogg"
+            end
 
           <<0x52, 0x49, 0x46, 0x46, _, _, _, _>> ->
             "audio/wav"