fix(library): preview sidecar-sliced .gcode.3mf rows as G-code, not ZIP bytes (#1709)

slice_and_persist writes a .gcode.3mf ZIP container but persisted the row
  with file_type="gcode". The G-code preview endpoint short-circuits on
  file_type == "gcode" and returns the bytes as text/plain, so the embedded
  viewer received the raw ZIP body instead of the embedded toolpath.

  - Persist file_type="gcode.3mf" on sliced rows (matches _classify_file_type
    and external-scan rows).
  - get_gcode also routes to the unzip branch when the filename ends with
    .gcode.3mf, so rows already written under the bug self-heal on first
    preview without a DB migration.
  - Extend FileManagerPage badge + viewer-eye gate and ProjectDetailPage badge
    to accept "gcode.3mf"; isSlicedFilename / isSliceableFilename already do.
  - Add test_library_get_gcode_recovers_legacy_gcode_type_for_3mf: legacy
    row preview must be text/plain, contain G28, and NOT start with PK.
This commit is contained in:
maziggy
2026-06-12 10:42:02 +02:00
parent 908227e4df
commit 857a071306
7 changed files with 55 additions and 17 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -26,7 +26,7 @@
<!-- Splash screens for iOS -->
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
<script type="module" crossorigin src="/assets/index-VyNhPxaj.js"></script>
<script type="module" crossorigin src="/assets/index-C-AWhT3K.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-45eedLWT.css">
</head>
<body>