Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
filedir_FAIL.patch | 1.02 KB | benjy | |
filedir_PASS.patch | 2.01 KB | benjy | |
Comments
Comment #2
benjy CreditAttribution: benjy commentedBack to NR
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedThx for the new test.
Comment #4
alexpottSo 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.
Comment #5
benjy CreditAttribution: benjy commentedDiscussed with @alexpott on IRC and it was decided that copy shouldn't create the directory structure much like UNIX
cp
.