fix(slicer): write slice output to the source's external folder (#2810)

slice_and_persist always wrote to get_library_files_dir() while giving the
new row the source folder's id, so slicing a file on a NAS mount produced
a .gcode.3mf that showed up in the right folder in the UI and never
reached the share -- invisible from the web UI, which is why it did not
reproduce.

Resolve the destination from the target folder like uploads (#1112) and
moves already do, set is_external and store the absolute path. Collisions
uniquify to "Model (2).gcode.3mf": a 409 would throw away minutes of CPU
on a routine re-slice, and overwriting a file on someone's NAS is worse.

An external folder that cannot take the file (read-only, unreachable, not
writable) falls back to managed storage rather than discarding the slice,
and reports why on SliceResponse.external_write_fallback -- surfaced as a
warning toast. Silent fallback is what made this bug invisible.
This commit is contained in:
maziggy
2026-08-11 09:02:52 +02:00
parent b63adb8151
commit 3dc681d9f1
21 changed files with 390 additions and 18 deletions
+5
View File
@@ -1860,6 +1860,11 @@ export interface SliceResponse {
filament_used_g: number;
filament_used_mm: number;
used_embedded_settings: boolean;
/** Why the result could not be written to the external folder the source
* lives in, and so went to managed storage instead. Null on every normal
* slice. Surfaced to the user — a file filed somewhere they aren't looking
* with no signal is what made #2810 invisible from the UI. */
external_write_fallback?: string | null;
}
export interface SliceArchiveResponse {