| Project: | File (Field) Paths |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I have been testing Filefield_paths with Image (as an alternative to the enhancement to Image proposed in #103793: Add token support for image file directory and image names). The attached patch addresses three areas that were preventing me from making full use of Filefield_paths with Image:
- The admin form field was not long enough for my list of tokens which I wanted to build the Image file path from.
- If I used a taxonomy token but my node had no taxonomy set, a path was created with '//'.
- When I used the Update option "Rebuild derivative images" in the admin/content/node form, the selected nodes were not processed to apply the new token values.
Note: I think the second point is not the same as a recent issue regarding double slashes appearing when individual terms in a hierarchy were not set.
I have tested the patch against a CVS export of DRUPAL-6--1. I hope that's the most appropriate code version. I had some minor problems applying the patch against the 6.x-1.3 tar files, I think because one set of files is created with Windows line terminators and the other without?
Note: there is a complimentary patch against Image for a couple of small changes there.
Comments
#1
Hmm... didn't realise I would not be able to edit the original post to add the attachment. So here it is. The related issue in Image is #564690: Improve support for Filefield_paths to tokenise image filename and path.
#2
Additional testing has highlighted a problem with the "double slash" conversion - it should have been converting any number of consecutive slashes into a single one but wasn't, causing image files to be lost during rebuild of derivatives. Revised patch attached.
#3
Hi sp3boy,
Sorry I've been so absent of lately but I've had a lot going on.
As I don't like committing code without being 100% sure that it's the best way to fix an issue, can you provide me with a brief step-by-step on how to reproduce each of the three issues so that I can confirm the fix?
Cheers,
Deciphered.
#4
I quite understand and would be more worried if you were happy to commit the patch unquestioned!
The first issue is not so easy to replicate in practice unless you have a site with complex multi-vocabulary taxonomy and fairly elaborate path requirements (which I have, hence the default 128 field size was not enough!). The simplest way I've found to illustrate the physical limit on that field is to copy "1234567890" into the clipboard and try pasting it into the field 13 times. It should refuse to accept more than 8 characters of the 13th paste.
For the other two, here's my best shot at a minimal test. By the nature of what I'm trying to achieve on my site, there are various components:
Set-up
Testing pre-patch
Testing post-patch
I hope that provides adequate information.
Thanks and regards.
#5
Further to my first patch, I have found another couple of issues which are additionally addressed in this revised patch:
image_filefield_paths_update()hook was firing thefilefield_paths_nodeapi()to process each file a second time, even though the node was not an Image. This was generating errors on moving the files because they had already been moved by the action of theupload_filefield_paths_update(). I have put in a test for the$node->imagesbeing set.upload_load()picks it up as it does a "SELECT *" from {files}). This prevents retro-active changes from being able to work from the original name and give an entirely predictable result. I have added this data capture toimage_filefield_paths_get_fields().BTW the "double-spaced" appearance of the patch is due I think to the CVS copies of the module files having Windows line terminators (CR + LF) which is confusing my CVSNT software somewhat (it wants to convert them to CR + CR + LF).
#6
Patch looks good to me,
Will apply it shortly and give it a run through.
Cheers,
Deciphered.
#7
After a lot more testing I have no changes to this patch but quite a few to the corresponding patch against Image. Please see #564690: Improve support for Filefield_paths to tokenise image filename and path for the latest.
#8
I did make a change to the patch, but only very minor.
I will do my best to get this committed ASAP.
#9
Committed to DRUPAL-6--1.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.