From 127f99ae18eea7732e8cb7756a102ca4c5beacca Mon Sep 17 00:00:00 2001 From: href Date: Mon, 4 Feb 2019 17:44:41 +0100 Subject: [PATCH] Mime: detect RIFF formats (wave, webp, avi) --- lib/pleroma/mime.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/mime.ex b/lib/pleroma/mime.ex index 84fb536e0..36771533f 100644 --- a/lib/pleroma/mime.ex +++ b/lib/pleroma/mime.ex @@ -102,10 +102,18 @@ defmodule Pleroma.MIME do "audio/ogg" end - defp check_mime_type(<<0x52, 0x49, 0x46, 0x46, _::binary>>) do + defp check_mime_type(<<"RIFF", _::binary-size(4), "WAVE", _::binary>>) do "audio/wav" end + defp check_mime_type(<<"RIFF", _::binary-size(4), "WEBP", _::binary>>) do + "image/webp" + end + + defp check_mime_type(<<"RIFF", _::binary-size(4), "AVI.", _::binary>>) do + "video/avi" + end + defp check_mime_type(_) do @default end -- 2.45.2