From 5661a8716355c285b3319ec7a7adf3fef93b95fe Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Thu, 7 Oct 2010 01:26:03 +0000
Subject: [PATCH] Fix entity inspection in file fetcher.

---
 CHANGELOG.txt    | 1 +
 mappers/file.inc | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2ed5dc55..02777b2f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -3,6 +3,7 @@
 Feeds 7.x 2.0 XXXXXXXXXXXXXXXXXXX
 ---------------------------------
 
+- Fix entity inspection in file fetcher.
 - #932772 alex_b: FeedsProcessor: Consolidate process() and clear().
   FeedsProcessor now implements the process() and clear() methods for creating
   and deleting entities. The extending processors FeedsNodeProcessor,
diff --git a/mappers/file.inc b/mappers/file.inc
index f5346fd7..1800e0bc 100644
--- a/mappers/file.inc
+++ b/mappers/file.inc
@@ -63,9 +63,9 @@ function file_feeds_set_target($entity, $target, $value) {
 
   // Determine file destination.
   // @todo This needs review and debugging.
+  list($entity_id, $vid, $bundle_name) = entity_extract_ids($entity->feeds_item->entity_type, $entity);
+  $instance_info = field_info_instance($entity->feeds_item->entity_type, $target, $bundle_name);
   $info = field_info_field($target);
-  $bundle_name = $entity->entity_type == 'node' ? $entity->type : $entity->entity_type;
-  $instance_info = field_info_instance($entity->entity_type, $target, $bundle_name);
   $account = !empty($entity->uid) ? user_load($entity->uid) : NULL;
   $destination = file_field_widget_uri($info, $instance_info, $account);
 
-- 
GitLab