Grotti 2.2.6: Wand-Vorschau, dichterer 3D-Pfad, ASCII-Dateinamen.
Kacheln zeigen Moonraker-Thumbnails; Toolpath-Thinning behält ganze Schichten; Nicht-ASCII-Namen vermeiden 10115 beim Senden.
This commit is contained in:
1 parent
7da895bbcd
commit
b277ca48aa
16 files changed
+302
-50
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""ASCII-Dateinamen für Moonraker-Upload."""
|
||||
|
||||
from grotti.moonraker import multipart, safe_upload_name
|
||||
|
||||
|
||||
def test_safe_upload_strips_cjk():
|
||||
name = "1015-2159-虎钳式强力夹子_plate(01)_PLA_0.2_53m57s.gcode"
|
||||
safe = safe_upload_name(name)
|
||||
assert safe.isascii()
|
||||
assert safe.endswith(".gcode")
|
||||
assert "plate(01)" in safe
|
||||
assert "虎" not in safe
|
||||
|
||||
|
||||
def test_multipart_single_ascii_filename():
|
||||
name = "模型_test.gcode"
|
||||
_boundary, body = multipart(name, b"G28\n")
|
||||
head = body.split(b"G28\n", 1)[0].decode("ascii")
|
||||
assert "filename*=UTF-8" not in head
|
||||
assert 'filename="test.gcode"' in head
|
||||
assert all(ord(ch) < 128 for ch in head)
|
||||
|
||||
|
||||
def test_safe_upload_preserves_path():
|
||||
assert safe_upload_name("subdir/foo.gcode") == "subdir/foo.gcode"
|
||||
Reference in new issue
Block a user