
Switching uploadpath.module to using presave allows more flexibility when dealing with uploads. It can't quite fix #154971: wrong url in "File attachments", but at least it makes it possible to work around. Like others, I have the trouble where the initial upload path is wrong (causing all kinds of dead images when posting them into the body) until the node is updated. Because the insert/update actions take place after the "base" node has already been saved, it's impossible to update the body or teaser fields without doing a second SQL query to update these fields.
Switching to "presave" makes it so that the new uploaded file path is available to other modules. Making it possible (in my particular case) to update all the URLs that reference these files in the body and teaser. Tested and this patch has no direct effect on the functionality of the module.
Comment | File | Size | Author |
---|---|---|---|
uploadpath_presave.patch | 733 bytes | quicksketch |
Comments
Comment #1
quicksketchHere's an example of a hook_nodeapi() that updates links in the body and teaser, after the uploadpath.module has been switched to presave. Note that this module must have a heavier weight than uploadpath.module to work.