diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2273b6002b6b22e8cab566806a1bf511d31f5cd0..e07c7e01170bc1e59c2365842ef5105538e0ea43 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,8 @@ Feeds 6.x xxxxxxxxxxxxxxxxxxxxxx -------------------------------- +- #755556 Monkey Master, andrewlevine, alex_b: Support saving local files in + filefields. - #891982 bangpound, twistor: Support Link 2.x. - #870278 budda: Fix SQL query in taxonomy_get_term_by_name_vid(). - #795114 budda, alex_b: Taxonomy term processor doesn't require vocabulary to diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 4128cbf5d8f0349e01cb014427b5e40c1324a78f..87e6bb86b567c74a98d6f40e1ef666a823e90838 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -245,6 +245,16 @@ class FeedsEnclosure extends FeedsElement { */ public function getFile() { if(empty($this->file) && $this->getValue()) { + // Check if this enclosure contains a local file. + if (!parse_url($this->getValue(), PHP_URL_SCHEME)) { + if (file_check_location($this->getValue(), file_directory_path())) { + if (file_exists($this->getValue())) { + $this->file = $this->getValue(); + return $this->file; + } + } + throw new Exception(t('Invalid enclosure %enclosure', array('%enclosure' => $this->getValue()))); + } $filename = basename($this->getValue()); if (module_exists('transliteration')) { require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc');