Images are being renamed any time i save node. Checkbox in field settings does not change a thing. Same on DEV verson.

Comments

h0tw1r3’s picture

Title: "Auto update" is always enabled » "Auto updating" is always enabled
Assigned: Unassigned » h0tw1r3

Confirmed. The way filefield_paths determined if a file was "new" in D6 no longer works in D7. Looking at the problem, I don't immediately see an easy fix. Will keep working on it. Patches or suggestions are most welcome!

TommyChris’s picture

I tried to use md5 random hash in file name. But every time, i'm editing a node, the files get new names.

My goal is to hide original filenames with the hash only ONCE. After it, I want to remain the file names.

Is it possible?

fasdalf@fasdalf.ru’s picture

@TommyChris: You can use file ID [file:fid] - it will change never.

TommyChris’s picture

But the id is an auto increment number.

So, if somebody opens the 45.jpg, there is maybe a 46.jpg or a 47.jpg. But, if I use md5 hash, no one can guess other file name.

fasdalf@fasdalf.ru’s picture

If i wold hide files from my users, i'd call them like nid/fid-file.timestamp.ext It does not change too, but it's impossible to brute-force through this combination.

fasdalf@fasdalf.ru’s picture

{file_managed}.status column still changes after node save only. Is it possible to use this DB field's change?

h0tw1r3’s picture

No, because we allow node tokens to be used. The node is usually created after the file or image has been uploaded. By that time {file_manage}.status is not useful. Node tokens cause a number of problems in FFP.

The only clear option I can see is removing support for [node] tokens, until something akin to transactions are supported for entity (node) bundles.

Suggestions?

fasdalf@fasdalf.ru’s picture

So FFP should update file names if node does not exist yet (for new nodes) or if file status is 0 (for new files in saved nodes).
Am i wrong again?

fasdalf@fasdalf.ru’s picture

For current DEV version i have file changing its name from "sites/default/files/2011/image1.jpg" to "sites/default/files/2011/image1_0.jpg" and back on any node save. So sometimes i need to resave node to see images again.

h0tw1r3’s picture

@fasdalf@fasdalf.ru: Yes I believe it should update immediately on upload. How else can the content be effectively referenced by other entities in the bundle (ex. pasting links into the nodes content body) when the node has not been created yet?

I am sitting on a patch that fixes this issue and the following:

But I am holding off pushing it out because it alters how the node token is supported.

I am considering adding individual options to the path and file clean up settings that would allow the administrator to conditionally enable "active updating" for each individually rather than for the overall field. This would allow you to put in a md5 hash token that only updates once (active updating off for file name), and node token in the path (active updating on for the file path). There would be a specific warning message indicating what happens with these options enabled. The means that for node token to be supported, active updating would need to be enabled.

@Deciphered, am I going in the wrong direction? What are your thoughts?

Deciphered’s picture

Status: Active » Closed (duplicate)

Marking this as a duplicate of #1278004: Wrong detection of status as a new file when editing node, even though there seems to be some good discussion in this thread.