Project:File (Field) Paths
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

I posted this issue in the Path Filter issue queue (#635164: Compatibility with Path Filter module), but the truth is, I wonder if it belongs here. Either way, I believe FileField Paths (FFP) and Path Filter 6.x-2.0-beta3 (PF) are incompatible. Path Filter converts and saves internal paths using a custom format; in the case of files, that format is something like "files:test.png".

I have FFP configured to move my files to "nodes/[nid]". So, a file temporarily uploaded to "sites/default/files/test.png", on node 10, would end up at "sites/default/files/nodes/10/test.png", and the references in my body field would be updated accordingly.

However, when I enable PF on my input filter, the body field gets "internalized" during the presave operation, so that the path changes from "sites/default/files/test.png" to "files:test.png". Thus, FFP cannot successfully replace the old path with the new path, because the old path has been changed/internalized by PF.

(Note: this only happens for files which haven't been moved by FFP already. If I upload the file, but DON'T add the path to my body field, click save, then edit it, and add the path to my body field, this is not a problem. But, that method is cumbersome for my users.)

I see two approaches making these modules compatible.

1) Have FFP check if PF exists and is enabled for this input filter, and then, instead of replacing "sites/default/files/test.png" with "sites/default/files/nodes/10/test.png", replace "files:test.png" with "files:nodes/10/test.png". FFP has workarounds built-in for Pathauto, Transliteration, and CCK, so I think a workaround for Path Filter is also in order.

2) Have PF implement hook_filefield_paths_process_file(), and there search for the internalized version of the "old" path and replace with the internalized version of the "new" path.

I'm willing to help write the patch for this, but after fumbling around in the code of these two modules, I don't know which is the best solution.

Comments

#1

Response made in the other issue.

#2

I added the include file, which you provided in the other ticket, to filefield_paths/modules and it works great. I recommend we include it as part of FFP.

#3

Status:active» closed (duplicate)

Marking as duplicate, other issue now in FileField Paths issue queue.

Cheers,
Deciphered.