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."
/**
* 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.
Comment | File | Size | Author |
---|---|---|---|
#3 | pathauto_entity-sandbox--issue-1540010-3.patch | 939 bytes | donquixote |
Comments
Comment #1
attiks CreditAttribution: attiks commentedI created a link inside #1025870: Previewing a node causes $node->uri['path'] to be set to 'node/' in hook_node_insert()
Comment #2
donquixote CreditAttribution: donquixote commentedA 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.
Comment #3
donquixote CreditAttribution: donquixote commentedPatch
Comment #4
areikiera CreditAttribution: areikiera commentedFor 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!
Comment #5
spessex CreditAttribution: spessex commentedI 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?
Comment #6
spessex CreditAttribution: spessex commentedFound it 'damzSANDBOX'
Comment #7
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedThis has been merged into Pathauto Entity in my sandbox (a fork of this module).
Should we mark it as fixed here then?