Hi,

currently a token replacement like [ffp-name-only-original].[ffp-extension-original] does not cover the case
of filenames ending with a dot but with no extension (e.g. file.).

In these cases the replacement ends up adding an extra dot at the end of the destination name giving file.. as result.

This is because the token regexes for the file names assume that there are always characters after the last dot when extracting the extension to subtract from the file name, I think this assumption can be relaxed.

I am going to send a patch which also covers some extra degenerate cases.

I tested the new regexes with these cases:

  • file
  • file.
  • file.ext
  • .ext

JFTR, I experienced the problem with files coming from a D6 site I am migrating to D8, in D6 uploading files with any extension was allowed.

Ciao,
Antonio

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ao2 created an issue. See original summary.

ao2’s picture

ao2’s picture

Sending an updated patch as the previous one contained a typo which caused this warning:

preg_match(): Delimiter must not be alphanumeric or backslash filefield_paths.tokens.inc:65