diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2013-02-09 10:35:04 -0800 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2013-02-09 10:35:04 -0800 |
| commit | 7613d886f98299c36d667908c52401bd07eef1e0 (patch) | |
| tree | a31c4425c6a18a2691b3bf33f86c6a0dcff27689 /modules/gallery/helpers/movie.php | |
| parent | f4ecb7e65850ca0cac9f7d963c34f7cd20ee9446 (diff) | |
| parent | 0312d1b071bd4434ddb3f82888b0323da6bf3732 (diff) | |
Merge pull request #128 from shadlaws/fix_1994
#1994 - Make get_file_metadata throw an exception if photo or movie is unidentifiable/illegal.
Diffstat (limited to 'modules/gallery/helpers/movie.php')
| -rw-r--r-- | modules/gallery/helpers/movie.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 6844771b..d4b907a2 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -192,8 +192,16 @@ class movie_Core { $metadata->extension = strtolower($extension); } - // Run movie_get_file_metadata events which can modify the class, then return results. + // Run movie_get_file_metadata events which can modify the class. module::event("movie_get_file_metadata", $file_path, $metadata); + + // If the post-events results are invalid, throw an exception. Note that, unlike photos, having + // zero width and height isn't considered invalid (as is the case when FFmpeg isn't installed). + if (!$metadata->mime_type || !$metadata->extension || + ($metadata->mime_type != legal_file::get_movie_types_by_extension($metadata->extension))) { + throw new Exception("@todo ILLEGAL_OR_UNINDENTIFIABLE_FILE"); + } + return array($metadata->width, $metadata->height, $metadata->mime_type, $metadata->extension, $metadata->duration); } |
