Skip to content
Snippets Groups Projects
Commit 8f278023 authored by twistor's avatar twistor Committed by Chris Leppanen
Browse files

Issue #2514300 by twistor: Fatal error when I try to import feed items

parent 562cca00
No related branches found
No related tags found
No related merge requests found
...@@ -112,8 +112,7 @@ function file_feeds_set_target(FeedsSource $source, $entity, $target, array $val ...@@ -112,8 +112,7 @@ function file_feeds_set_target(FeedsSource $source, $entity, $target, array $val
if ($v) { if ($v) {
try { try {
$v->setAllowedExtensions($instance_info['settings']['file_extensions']); $v->setAllowedExtensions($instance_info['settings']['file_extensions']);
$file = $v->getFile($destination); $field[LANGUAGE_NONE][$delta] += (array) $v->getFile($destination);
$field[LANGUAGE_NONE][$delta] += (array) $file;
// @todo: Figure out how to properly populate this field. // @todo: Figure out how to properly populate this field.
$field[LANGUAGE_NONE][$delta]['display'] = 1; $field[LANGUAGE_NONE][$delta]['display'] = 1;
} }
......
...@@ -435,7 +435,7 @@ class FeedsEnclosure extends FeedsElement { ...@@ -435,7 +435,7 @@ class FeedsEnclosure extends FeedsElement {
$file = new stdClass(); $file = new stdClass();
$file->uid = 0; $file->uid = 0;
$file->uri = $this->getSanitizedUri(); $file->uri = $this->getSanitizedUri();
$file->filemime = $this->mime_type; $file->filemime = $this->getMIMEType();
$file->filename = $this->getSafeFilename(); $file->filename = $this->getSafeFilename();
if (drupal_dirname($file->uri) !== $destination) { if (drupal_dirname($file->uri) !== $destination) {
......
...@@ -52,6 +52,7 @@ class FeedsSimplePieEnclosure extends FeedsEnclosure { ...@@ -52,6 +52,7 @@ class FeedsSimplePieEnclosure extends FeedsEnclosure {
public function getMIMEType() { public function getMIMEType() {
return $this->simplepie_enclosure->get_real_type(); return $this->simplepie_enclosure->get_real_type();
} }
} }
/** /**
...@@ -232,4 +233,5 @@ class FeedsSimplePieParser extends FeedsParser { ...@@ -232,4 +233,5 @@ class FeedsSimplePieParser extends FeedsParser {
$words = array_slice($words, 0, 3); $words = array_slice($words, 0, 3);
return implode(' ', $words); return implode(' ', $words);
} }
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Test single feeds. * Test single feeds.
*/ */
class FeedsSyndicationParserTestCase extends FeedsWebTestCase { class FeedsSyndicationParserTestCase extends FeedsWebTestCase {
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'Syndication parsers', 'name' => 'Syndication parsers',
...@@ -39,6 +40,15 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase { ...@@ -39,6 +40,15 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase {
$this->assertText('Created ' . $assertions['item_count'] . ' nodes'); $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 { ...@@ -55,4 +65,5 @@ class FeedsSyndicationParserTestCase extends FeedsWebTestCase {
), ),
); );
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment