Closed (fixed)
Project:
Feeds
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jul 2010 at 08:25 UTC
Updated:
10 Aug 2010 at 19:00 UTC
Jump to comment: Most recent file
Hello,
File enclosures are being renamed using the enclosure class, it looks like more debug stuff to me than a real feature. In case of name conflicts, Drupal core file handling will seamlessly rename the files.
The real annoying bug here is that users are being displayed files in filefield listing that have the enclosure class name.
Located where it's done:
In method FeedsEnclosure::getFile()
public function getFile() {
if(!isset($this->file) && $this->getValue()) {
$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;
}
else {
$this->file = file_save_data($this->getContent(), $dest);
}
if ($this->file === 0) {
throw new Exception(t('Cannot write content to %dest', array('%dest' => $dest)));
}
}
return $this->file;
}
Why not just let this happen :
$dest = file_destination(file_directory_temp() .'/'. $filename, FILE_EXISTS_RENAME);
Is there any reason to this ?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | feeds-6.x-1.0-beta3-EnclosureName.patch | 645 bytes | pounard |
Comments
Comment #1
pounardIn case you would also want to get rid of this infamous file names, patch attached.
Comment #2
alex_b commentedIndeed, there is no special reason why we're using the class in the file name, and it *does* look odd.
Comment #3
alex_b commentedThis is committed now, thank you.
http://drupal.org/cvs?commit=398528