To reproduce:

  1. Create a date field 'Datum' with start and end date (year month day)
  2. Create a file field
  3. Activate file field path und use this path: download/[node:field_datum]
  4. Create a custom display for Token (admin/structure/types/manage/_your_content_type/display) and configure the display of your date field
  5. Create a new content and upload a file

Result: you will get the date wrapped into a <span>:
http://www.domain.tld/download/<span class="date-display-single" property="dc:date" datatype="xsd:dateTime" content="2011-08-31T08:00:00+02:00">2011</span>/other_part.pdf

To fix
: strip tags before processing strings (see attached patch)

CommentFileSizeAuthor
striptags.patch417 bytesmiguel

Comments

neRok’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta4
Priority: Major » Normal
Issue summary: View changes
Status: Active » Closed (won't fix)

I have installed Date 2.7 and tested with latest FFP dev, as per your instructions.
PS- I think you need entity api module for the field-datum tokens.

I started with cleanup using pathauto disabled.
[node:field_datum] didnt return anything, and the file didnt get moved.
[node:field-datum] returned "Property field_datum", and the file got moved.
[node:field-datum:value] returned "Wed.03/12", so this actually made 2 folders, and the file didnt get moved.
I now enabled pathauto cleanup.
[node:field_datum] moved the image to folder "2014-03-12-000000-2014-03-13-000000".
[node:field-datum:value] made 3 folders this time, "wed-03/12/2014-0000", and the file got moved.
I gave up testing at this point, I came to the following realisation.

FFP doesn't make or change tokens, it just uses what it is given. If it is given garbage tokens, it will spit out garbage paths. It isn't the job of FFP to tweak tokens. I am guessing your token with the span in it has come about from some custom code you have written elsewhere? Perhaps you need to make a new token specifically to present your date info to FFP. Or if Date is giving spans itself, hence why it was only working when I had pathauto cleanup enabled, you will need to modify the Date token on the fly (or get Date module to use different tokens).

Also note that while you think it is a good idea to strip tags out of your tokens, other people may want to keep tags in. Take the title of this very issue for example, it has in the title. Someone using [node:title] may get unpredictable results with your patch.

Also regarding your patch, it doesn't appear to be in the structure I have read other patches, which show + and - lines, not before and after 'paragraphs'.