Inconsistent PNG and PDF upload filenaming conventions

Hello devs

I recently uploaded (using discourse 2.4.0.beta7 and current) two content‑identical files in PNG and PDF formats (to the openmod forum). Discourse automatically parses and records the originating filename in the markdown as follows:

Uploaded file name Indicated file Comment
bridge-2-a5-flier.04.png 04 annotated 1
bridge-2-a5-flier.04.pdf bridge-2-a5-flier.04.pdf annotated 2

Below is a screenshot, annotated “1” and “2” to indicate how this works:

It seems to me that the PNG case should record the original filename or, failing that, at least the entire stub as per: basename "bridge-2-a5-flier.04.png" ".png".

I looked around for similar bug reports but could only find traffic regarding the generation of the anonymized name string.

Thanks as always for this wonderful software. R


Agree, looks like a bug based on the period in the file name.


I’ve taken a look and it’s definitely a bug based on . in the filename. The composer is trying to just remove the extension so we end up with bridge-2-a5-flier.04|WIDTHxHEIGHT in the markdown, but it is just splitting the filename on the . and taking the first part of the file before the extension, which is obviously not correct.

From what I can see this bug has been present for two years, so thank you for being :eagle:-eyed and picking it up! I will push a fix today.


Fixed with FIX: Image file names with dots were showing incorrectly in composer markdown by martin-brennan · Pull Request #8465 · discourse/discourse · GitHub


This topic was automatically closed after 5 hours. New replies are no longer allowed.