From da724022fe27ef82fc6af2269cf42d2c4e41d299 Mon Sep 17 00:00:00 2001 From: hsgwon Date: Fri, 12 Apr 2019 18:28:20 +0900 Subject: [PATCH] [MediaContent] Add missing description and its related code (#788) --- .../Tizen.Content.MediaContent/MediaInfoCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs index 9b9f6be..3a820bf 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs @@ -954,6 +954,7 @@ namespace Tizen.Content.MediaContent /// /// /// Media in the external storage is not supported, with the exception of MMC. + /// Only JPEG, PNG, BMP images are supported. /// /// http://tizen.org/privilege/content.write /// http://tizen.org/feature/vision.face_recognition @@ -1018,6 +1019,14 @@ namespace Tizen.Content.MediaContent throw new UnsupportedContentException("Only image is supported."); } + // Native P/Invoke function also check below case, but it returns invalid operation error. + // So we check it here to throw more proper exception. + string mimeType = InteropHelper.GetString(handle, Interop.MediaInfo.GetMimeType); + if (!mimeType.Equals("image/jpeg") && !mimeType.Equals("image/png") && !mimeType.Equals("image/bmp")) + { + throw new UnsupportedContentException($"{mimeType} is not supported. Only JPEG, PNG, BMP is supported."); + } + var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); if (File.Exists(path) == false) -- 2.7.4