I am using the fieldfield_path module to create a redirect for my files as they come in during a migration (this is so that I can give an original path in the migration, and create a redirect, allowing me to redirect at the apache level from the old url to a new one, but also have extra information in the path that wasn't available from the old site path. The fieldfield path file path is set to publication_documents/pub/[node:field_doc_type_book]/[node:nid]
for my book content type public files field.
When I look at my migration messages I see the following message:
Creating redirect from
private://publication_documents/pub/old/1565/filename.pdf to
private://publication_documents/pub/book/37544/filename.pdf
Which is what I would expect, the nodeid of the node the file is attached to is 37544. Unfortunately when I actually visit /system/files/publication_documents/pub/old/1565/filename.pdf
I get redirected to system/files/publication_documents/pub/book/149678/filename.pdf
Which is a page not found error page. It is a mystery where the number 149678 came from, but I can confirm that the redirect happening is the one actually stored in the redirect table. I've looked through all of the node and revision ids, file ids, etc. that I could think of as possibly being the source of this mystery integer, but have had no luck so far. I removed all the migrated data and ran the migration again, but the integer on the redirect is still the same.
What might be happening? Why is drupal telling me it is creating one redirect, but actually creating another? I suspect it is actually creating the one it is telling me about, but then replacing it with another, but so far, I don't have any information to prove either theory.
I am using the media module, and wonder if that is somehow messing things up. I also have pathauto active.