Problem/Motivation

file_unmanaged_copy() calls file_prepare_directory() without the correct options and therefore directories are not created.

Proposed resolution

Call file_prepare_directory() with the FILE_CREATE_DIRECTORY option.

API changes

n/a

CommentFileSizeAuthor
filedir_FAIL.patch1.02 KBbenjy
filedir_PASS.patch2.01 KBbenjy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, filedir_FAIL.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review

Back to NR

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Thx for the new test.

alexpott’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Needs work

So I'm not sure if this is actually a bug. If I copy a file on the command line to a non existent directory I get an error message. At the very least we should replicate the bit mask on file_prepare_directory to file_unmanaged_copy. That way the caller could decide whether or not they consider the fact that the destination needs to be created as a bug or not.

benjy’s picture

Status: Needs work » Closed (works as designed)

Discussed with @alexpott on IRC and it was decided that copy shouldn't create the directory structure much like UNIX cp.