I noticed that when you edit/create a component type 'file', when I enter a destination directory, it initially creates one, but then creates another one in a different spot when you start actually submitting the form and uploading files. Damage is minor, as the files are still uploaded, but an unnecessary directory is potentially being created.
Steps to Replicate:
i) Edit/create component (type: File) - Eg. folder "webform/dropbox/student-groups/"
ii) Note that directory is created: sites>default>files>dropbox>student-groups>webform
iii) Submit form
iv) Note that file is actually placed in site>default>files>webform>dropbox>student-groups
Not clear if a bug or a feature I don't fully understand, however thought I should mention it.
Simon
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform-7.x-3.x-2096525-2.patch | 650 bytes | guedressel |
| #2 | webform-7.x-4.x-2096525-2.patch | 650 bytes | guedressel |
Comments
Comment #0.0
slismann commentedadded one folder item i missed
Comment #1
guedressel commentedI just discovered the source of this problem.
But I'm working on version 3.20.
Guess this issue affects more versions...
Comment #2
guedressel commentedHere are (very trivial) patches to fix this issue.
Patch for 3.x also works for current release 3.20
Comment #3
quicksketchDoh! What an obvious problem. Thanks @guedressel! This should be committed on the next pass through the issue queue.
Comment #4
guedressel commentedAonther thought:
Remove the whole line of code - instead of patching it. It's not necessary to create the directory when a file component gets created.
The directory will be created on the first upload anyways.
This would not lead to empty and never used directories...
Comment #5
quicksketchIf there's an error creating the directory, it'd be better to give that to the admin/editor user setting up the Webform than the end-user filling out the form. I think that's the reason for adding/checking it on component save.
Comment #6
guedressel commentedIf there's an error creating directories in the Drupal public/private files destination Drupal itself will bring up loads of errors before. Don't you think?
Comment #7
quicksketchIt depends. Never underestimate an administrator's ability to completely screw up their file permissions. It's entirely possible that different directories will have different permissions, so /files/js might be writable but /files/webform may not. I'd still prefer to keep the check where it is.
The patches are still good, so I've committed them. Thanks for your finding/fixing!
Comment #10
quicksketchComment #11
fenstratNeeds porting to 8.x-4.x.
Comment #12
fenstratCommitted and pushed ed7a4b7 to 8.x-4.x. Thanks!