Why does OctoPrint display files on the printer's SD so weirdly?

sd

#1

OctoPrint displays files from your printer's SD card in DOS 8.3 format because this is how it receives them from your printer's firmware:

>>> M20
<<< Begin file list
<<< MK3_PL~1.GCO 1292573
<<< MK3_PL~2.GCO 5812176
<<< MK3_PL~3.GCO 3190208
<<< MK3_PL~4.GCO 38102949
<<< MK3686~1.GCO 350775
<<< MK310C~1.GCO 1669802
<<< MK2E6F~1.GCO 9426676
<<< MK84CF~1.GCO 38935303
<<< MK57DB~1.GCO 20070962
<<< MK4CEF~1.GCO 23558921
<<< MK7400~1.GCO 456914
<<< MK9F5E~1.GCO 19026227
<<< MK6E26~1.GCO 29052944
<<< MKC88B~1.GCO 19661697
<<< LOWER_~1.GCO 3004206
<<< CORNER~1.GCO 12591171
<<< TOP_PA~1.GCO 1685493
<<< ONLY_H~1.GCO 53
<<< TRISPI~1.GCO 2255391
<<< 20MM-B~1.GCO 140760
<<< TOP_PA~2.GCO 1824381
<<< PRUSAT~1.GCO 2255391
<<< LITHOP~1.GCO 364087
<<< LITHO_~1.GCO 4578509
<<< LITHOP~2.GCO 5847248
<<< LITHOP~3.GCO 4829981
<<< LITHOP~4.GCO 9009070
<<< LAMP_B~1.GCO 3251150
<<< LAMP_B~2.GCO 3382527
<<< BASIC_~1.GCO 231093
<<< COVER_~1.GCO 342502
<<< OCTORE~1.GCO 3514373
<<< End file list

Some newer firmware variants out there support a command M33 to retrieve the long name stored along side the file on the SD for one single file. This is sadly not feasible to use by OctoPrint since it would have to send first the file list command M20 and then an M33 for each and every file stored on your printer's SD. That would pretty much lock up the serial connection to the printer for an undeterminable amount of time with n+1 request/response pairs.

So unless firmwares extend the M20 command with the long filename (which has been talked about but sadly never was implemented anywhere as far as I know) or provide an alternative that allows retrieving all long names from the SD, OctoPrint will have to keep displaying the 8.3 file names since blocking the serial communication just for file list retrieval is simply unacceptable default behaviour.