Problem/Motivation

After upgrading a site to latest 7.x core and all the modules when uploading an image using the media browser widget the second page lists no destinations.

Proposed resolution

Issue appears to be in file_entity.pages.inc with the removing any schemes not in the instance settings. It is using array_intersect_key() but $options['schemes'] are numerical indexes and file_get_stream_wrappers() is associative:

array (size=3)
  'rcf' => string 'Rackspace Cloud Files.' (length=22)
  'public' => string 'Public local files served by the webserver.' (length=43)
  'private' => string 'Private local files served by Drupal.' (length=37)
  'schemes' => 
    array (size=2)
      0 => string 'public' (length=6)
      1 => string 'private' (length=7)

I've attached a patch file that I believe should resolve this issue but would prefer review.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmclelland’s picture

Status: Active » Needs review

Setting the correct status to NR.

Status: Needs review » Needs work

The last submitted patch, file_entity.pages_.inc_.patch, failed testing.

Say_Ten’s picture

Updated patch file that should apply correctly, sorry new to creation of git patches for Drupal.

Say_Ten’s picture

Status: Needs work » Needs review
jonathan_hunt’s picture

Works for me, thanks.

mariancalinro’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too.

+++ b/file_entity.pages.inc
@@ -165,7 +165,7 @@ function file_entity_add_upload_step_scheme($form, &$form_state, array $options
+    $schemes = array_intersect_key($schemes, array_flip($options['schemes']));

However, on first glance it's not obvious why an array_flip is needed, maybe a comment describing the issue would help for others going over the code.

I'm going to change this in RTBC, because i suspect a lot of people will get bitten by this, and it's not so strait forward to identify what's going on. If the maintainer thinks it needs more work, than he can change it back to needs work.

aaron’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev

  • aaron committed 542c154 on 7.x-2.x
    Issue #2411391 by Say_Ten: fixed File destination not showing
    
aaron’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.