GcodeFilenameFormat icon indicating copy to clipboard operation
GcodeFilenameFormat copied to clipboard

Feature request: replace symbols

Open thghca opened this issue 3 years ago • 4 comments

Hi. I'm using espwebdav for file upload and it buggy with non ascii and some other chars. Marlin may not like them too. Renaming every time annoying.

Would it possible to implement simple character replace table? And length limiting will be nice too.

thghca avatar Apr 30 '21 12:04 thghca

Hello I'm not familiar with espwebdav and webdav so I will have to do some research on its filename limitations. Are you using espwebdav with a Wifi SD card?

What GFF format are you using? Can you give me an example of the filename that Cura and GFF are producing from your sliced objects?

rgomezjnr avatar May 09 '21 18:05 rgomezjnr

Hello @thghca do you still have this issue? Or did you find another solution?

rgomezjnr avatar Jun 03 '21 21:06 rgomezjnr

Hi. I had troubles with non ASCII (russian letters), some special characters like %&<>#$... and whitespaces. For now i forked ESpWebDAV and made it work with utf8 and whitespaces. (I hope. Not much tested yet) % and & and maybe others still issue, so i just reject filenames with them on server side.

Well Issue mostly resolved but some simple replace functionality will be good. (filter out problematic chars, replace whitespaces with underscore...)

Heh. Printer can't display russian characters. =(

thghca avatar Sep 01 '21 08:09 thghca

Can you give me an example filename format you are attempting to use so I can test?

Hi. I had troubles with non ASCII (russian letters), some special characters like %&<>#$... and whitespaces.

GFF does support whitespace, which makes me think this is more so a character encoding issue.

I can easily add support for additional characters like &, #.

FYI this is the current regex used in GFF for determining acceptable filenames. The characters after \ "-%°$£€" are accepted and should be included in the filename.

filename_format = re.sub('[^A-Za-z0-9._\-%°$£€ ]+', '', filename_format)

If the characters listed above aren't working for you then I need to see an example of how you're using them to see if they are being filtered out by the regex.

Well Issue mostly resolved but some simple replace functionality will be good. (filter out problematic chars, replace whitespaces with underscore...) Marlin may not like them too. Heh. Printer can't display russian characters. =(

It doesn't make sense to implement character replacement in GFF if the 3D printer can't support them anyways. So I think its better to cleanup the filename before it gets to Cura and GFF. Can I help you implement filename sanitization on your server or ESpWebDAV?

Also, if you're interested, I recently released a newer version of the plugin called GcodeFilenameFormatPlus that supports multi-extruder printers and the OctoPrint server.

rgomezjnr avatar Sep 03 '21 02:09 rgomezjnr