Improve token replacement for files without extension

Created on 26 November 2017, about 7 years ago
Updated 4 December 2024, about 2 months ago

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

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇹Italy ao2

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024