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 ?

CommentFileSizeAuthor
#1 feeds-6.x-1.0-beta3-EnclosureName.patch645 bytespounard

Comments

pounard’s picture

StatusFileSize
new645 bytes

In case you would also want to get rid of this infamous file names, patch attached.

alex_b’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Status: Active » Needs review

Indeed, there is no special reason why we're using the class in the file name, and it *does* look odd.

alex_b’s picture

Title: File enclosures are being renamed using the enclosure class » Do not name files after their enclosure class.
Status: Needs review » Fixed

This is committed now, thank you.

http://drupal.org/cvs?commit=398528

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.