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.
Windows, Apache 2.4.12, Drupal 7.41, FileField Sources 7.x 1.10
We defined a directory, where we copied the files via ftp - it is working without problems.
Now we want to upload a file from this directory with the attach_mode 'move', so that the file will be moved to the final destination and will be deleted in the attach directory, but the file will not be deleted. Why?
Can I track this with a log or something else? I can't find out why the files will not be deleted. Any hints?
Comment | File | Size | Author |
---|---|---|---|
#6 | filefield_sources-fix-move-2638914.patch | 934 bytes | quicksketch |
#2 | filefield_sources-drupal_attached-file-not-removed-on-move-mode-2638914-1.patch | 640 bytes | tien.xuan.vo |
Comments
Comment #2
tien.xuan.vo CreditAttribution: tien.xuan.vo as a volunteer commentedI confirm this is a bug. I saw this bug when running test cases on drupal 8 version of this module. The reason is there is a wrong condition that make source file will not be deleted.
Comment #3
tien.xuan.vo CreditAttribution: tien.xuan.vo as a volunteer commentedAnd sorry for the name of the patch. It should be filefield_sources-drupal_attached-file-not-removed-on-move-mode-2638914-2.patch
Comment #4
Matroschker CreditAttribution: Matroschker commentedThank you very much, the patch worked for me (comment #2)
Comment #5
Bohus UlrychHi, this path is not working for me, I'm not able to save node - error message is:
An illegal choice has been detected. Please contact the site administrator.
Tested on fresh minimal installation of Drupal 7.56, filefield_sources 1.10
At the end I used two hooks hook_node_insert() and hook_node_update() and
unlink($node->field_my_field_name['und'][0]['filefield_attach']['filename']);
Comment #6
quicksketchThanks @tien.xuan.vo. I'd prefer to check the file path condition rather than remove it entirely. I have seen situations where the attach directory is the same thing as the destination, we had a dedicated issue for it at #1492374: Attach source reference existing file where it's the same as source (which is probably where this regression was created).
This patch fixes the condition and maintains the ability to have the target be the same as the destination.