Skip to content
Snippets Groups Projects
Commit 526bbbba authored by Alex Barth's avatar Alex Barth
Browse files

#840350 lyricnz: (Optionally) Transliterate enclosure filenames to provide...

#840350 lyricnz: (Optionally) Transliterate enclosure filenames to provide protection from awkward names.
parent fb026479
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
Feeds 6.x 1.X XXXX
------------------
- #840350 lyricnz: (Optionally) Transliterate enclosure filenames to provide
protection from awkward names.
- #842040 dixon_: Accept all responses from the 2xx status code series.
- #836982 Steven Merrill: Fix Feeds.module tests do not work when run from the
command line.
......
......@@ -81,6 +81,14 @@ external library used at the moment is SimplePie.
Libraries found in the libraries search path are preferred over libraries in
feeds/libraries/.
Transliteration support
=======================
If you plan to store files with Feeds - for instance when storing podcasts
or images from syndication feeds - it is recommended to enable the
Transliteration module to avoid issues with non-ASCII characters in file names.
http://drupal.org/project/transliteration
API Overview
============
......
......@@ -163,7 +163,12 @@ class FeedsEnclosure extends FeedsElement {
*/
public function getFile() {
if(!isset($this->file) && $this->getValue()) {
$dest = file_destination(file_directory_temp() .'/'. get_class($this) .'-'. basename($this->getValue()), FILE_EXISTS_RENAME);
$filename = basename($this->getValue());
if (module_exists('transliteration')) {
require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc');
$filename = transliteration_clean_filename($filename);
}
$dest = file_destination(file_directory_temp() .'/'. get_class($this) .'-'. $filename, FILE_EXISTS_RENAME);
if (ini_get('allow_url_fopen')) {
$this->file = copy($this->getValue(), $dest) ? $dest : 0;
}
......
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