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

6 Likes

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

4 Likes

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.

6 Likes

Fixed with https://github.com/discourse/discourse/pull/8465

5 Likes

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