#755556: Support saving local files in filefields added the ability to save local files to a FileField, and as a security measure, a check with file_directory_path() was added.
However, if an importer wants to download a file and save it directly to a FileField, it makes more sense to save it to a temporary directory instead of persistent storage like the files directory.
The use case for this is e-mail attachments with Mailhandler 2.x: there are no remote URLs for attachments, and the file data exists within the message itself. Rather than saving e-mail attachments into a public folder without context, it makes more sense to be able to save a file in temp, add it to a FileField (which may benefit from permissions), and delete the temporary file.
Attached is a patch that checks file_directory_temp() in addition to file_directory_path()
.
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds-926616.patch | 947 bytes | Mark Trapp |
feeds-getfile_temp.patch | 948 bytes | Mark Trapp | |
Comments
Comment #1
alex_b CreditAttribution: alex_b commentedThis looks good. Will need porting to Drupal 7.
Comment #2
Mark TrappOne too many parentheses: attached is a working patch.
I'll look at providing a port for D7 this weekend; I'm pretty sure it's simple and straightforward, but I don't have anything on hand to test it with.
Comment #3
alex_b CreditAttribution: alex_b commentedCool. Should be straightforward, yes.
There is a new release of Feeds Test Site for Drupal 7 which should get you started fast on D7: http://drupal.org/node/927742 (I just created the release, give it a little to publish).
Comment #4
Mark TrappI finally got around to testing this in Drupal 7, and I wish I did it sooner: this is a non-issue in Feeds 7.x-2.x, as it does not place a constraint requiring the file to be in the public files directory.
As such, only Feeds 6.x-1.x-dev needs to be patched: the patch in #2 is still valid.
Note: #927014: Provide e-mail attachments as FeedEnclosure objects to support FileField mappings for Mailhandler 6.x-2.x depends on this patch.
Comment #5
alex_b CreditAttribution: alex_b commentedCommitted, thank you:
http://drupal.org/cvs?commit=441450
Comment #6
Mark TrappSweet, thanks!