diff --git a/mappers/file.inc b/mappers/file.inc index d46c31916ffe4d51094a35ea28bddd158339c8c9..4f705463799f8651f9f09c50cd01355ebcf7b969 100644 --- a/mappers/file.inc +++ b/mappers/file.inc @@ -112,8 +112,7 @@ function file_feeds_set_target(FeedsSource $source, $entity, $target, array $val if ($v) { try { $v->setAllowedExtensions($instance_info['settings']['file_extensions']); - $file = $v->getFile($destination); - $field[LANGUAGE_NONE][$delta] += (array) $file; + $field[LANGUAGE_NONE][$delta] += (array) $v->getFile($destination); // @todo: Figure out how to properly populate this field. $field[LANGUAGE_NONE][$delta]['display'] = 1; } diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 8b430c057914bf6947bf96c2fbb7d43e925b4544..81545d75d190071bb058fcec93183de7999ece97 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -435,7 +435,7 @@ class FeedsEnclosure extends FeedsElement { $file = new stdClass(); $file->uid = 0; $file->uri = $this->getSanitizedUri(); - $file->filemime = $this->mime_type; + $file->filemime = $this->getMIMEType(); $file->filename = $this->getSafeFilename(); if (drupal_dirname($file->uri) !== $destination) { diff --git a/plugins/FeedsSimplePieParser.inc b/plugins/FeedsSimplePieParser.inc index f87d91304e4efd16cf4d2a1df62bdf65b5aecee5..495b2a1a04b9aa3496374c9c853d701e045407c9 100644 --- a/plugins/FeedsSimplePieParser.inc +++ b/plugins/FeedsSimplePieParser.inc @@ -52,6 +52,7 @@ class FeedsSimplePieEnclosure extends FeedsEnclosure { public function getMIMEType() { return $this->simplepie_enclosure->get_real_type(); } + } /** @@ -232,4 +233,5 @@ class FeedsSimplePieParser extends FeedsParser { $words = array_slice($words, 0, 3); return implode(' ', $words); } + } diff --git a/tests/feeds_parser_syndication.test b/tests/feeds_parser_syndication.test index 1d45ad9be7bdb519e989fec3b4cead166870f28d..a62759f83553f74ac3aeaf3962d8fee1be5afc25 100644 --- a/tests/feeds_parser_syndication.test +++ b/tests/feeds_parser_syndication.test @@ -9,6 +9,7 @@ * Test single feeds. */ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { + public static function getInfo() { return array( 'name' => 'Syndication parsers', @@ -39,6 +40,15 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { $this->assertText('Created ' . $assertions['item_count'] . ' nodes'); } } + + feeds_include_simplepie(); + variable_set('feeds_never_use_curl', TRUE); + + $link = $GLOBALS['base_url'] . '/testing/feeds/flickr.xml'; + $enclosure = new FeedsSimplePieEnclosure(new SimplePie_Enclosure($link)); + + $enclosure->setAllowedExtensions('xml'); + $this->assertEqual(1, $enclosure->getFile('public://')->fid); } /** @@ -55,4 +65,5 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { ), ); } + }