When multiform is not enabled, file/add invokes drupal_get_form('file_entity_add_upload'), so media_form_file_entity_add_upload_alter() alters the form and injects Media's allowed file extensions. When multiform is enabled, file/add invokes a different form; 'file_entity_add_upload_multiple'. So, the form alter hook is never called, and Media's default file extensions are never added.

Patch coming

Comments

mstef’s picture

Status: Active » Needs review
StatusFileSize
new2.02 KB

Here's a simple patch. It removes media_form_file_entity_add_upload_alter() and places a switch() inside media_form_alter() that will execute the same code for either file_entity_add_upload or file_entity_add_upload_multiple.

kenianbei’s picture

Patch seems to work for me.

ParisLiakos’s picture

+++ b/media.moduleundefined
@@ -524,6 +524,21 @@ function media_form_alter(&$form, &$form_state, $form_id) {
+  ¶

whitespace detected:P

rooby’s picture

Status: Needs review » Needs work

A couple of minor coding standards fixes required:

+++ b/media.module
@@ -524,6 +524,21 @@ function media_form_alter(&$form, &$form_state, $form_id) {
+  ¶

Unnecessary white space.

+++ b/media.module
@@ -524,6 +524,21 @@ function media_form_alter(&$form, &$form_state, $form_id) {
+        // If the list of allowed extensions is the default provided by file_entity

Comments should not exceed 80 characters per line.

gmclelland’s picture

Status: Needs work » Needs review
StatusFileSize
new1.08 KB
new139.98 KB
new134.84 KB

Thanks @mstef - I tested your patch and it fixed the problem for me. Without this patch, I wasn't able to upload an mp4 video. See the attached screenshots for details on what this patch does.

I rerolled the patch to fix the white space errors and the comments characters per line. I would set this to RBTC, but I will let someone else make the change.

mstef’s picture

my mistake..

gmclelland’s picture

Status: Needs review » Closed (fixed)
StatusFileSize
new114.44 KB

I could be wrong, but I think this patch is no longer needed. With the latest 2.x-devs of media and file entity you can go to admin/config/media/file-system you will see a new field for "Default allowed file extensions." File/add will use the extensions there.

File system 2013-07-18 12-00-45.jpg

Reopen if you still think this is an issue.

gmclelland’s picture

Just for reference I think #2067283: Remove the obsolete file_extensions media variable makes the patch in #5 obsolete.

sheldonkreger’s picture

Issue summary: View changes