Spent 7 hours hunting this down yesterday when I found out what was causing it.

I have a site using Media, File Entity, and Pathauto Entity. What started was occurring was when I would go to upload a theme logo, or use Media Browser to insert a file into the WYSIWYG, the upload was failing with:

"The specified file could not be copied, because no file by that name exists. Please check that you supplied the correct filename."

#1538796: file_unmanged_copy() fails with "The specified file could not be copied, because no file by that name exists"


/**
 * Implements hook_entity_insert().
 */
function pathauto_entity_entity_insert($entity, $entity_type) {
  // @todo Remove the next line when http://drupal.org/node/1025870 is fixed.
  unset($entity->uri);
  pathauto_entity_update_alias($entity_type, $entity, 'insert');
}

The problem is that with File Entity, any uploaded file is treated like an entity and thus is fed through this function. Unsetting the URI causes a lot of issues with file inc because it can't find it.

Commenting out the unset fixed this error for me short term- without it uploading files to a website is completely broken.

I think 'file' can be excluded as an entity type like node and user are, though I have not had a chance to debug further.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

donquixote’s picture

A good temporary solution is to only unset($entity->uri), if there is actually a pathauto pattern.
Like this, we can simply not have pathauto for files.

donquixote’s picture

Status: Active » Needs review
FileSize
939 bytes

Patch

areikiera’s picture

For those jumping around in these issues and trying to piece all the info together, the patch from Comment #3 above has been folded into the patch (as noted in the issue) on https://drupal.org/node/1947226#comment-7707665.

Thanks @donquixote for this patch!

spessex’s picture

I am having the same problem but for the life of me cannot find the module in the file system to patch. I can see it in 'modules' on the site but not in the file structure. Does it go by some other name than Pathauto Entity?

spessex’s picture

Found it 'damzSANDBOX'

maciej.zgadzaj’s picture

Issue summary: View changes
Status: Needs review » Fixed

This has been merged into Pathauto Entity in my sandbox (a fork of this module).

Should we mark it as fixed here then?

Status: Fixed » Closed (fixed)

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