fix(linux): distinguish test capture jobs from printed jobs
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled
This commit is contained in:
parent
cc9031fcfd
commit
8d00d298df
@ -326,15 +326,16 @@ fn spool_folder_loop(
|
|||||||
|
|
||||||
match fs::read(&path) {
|
match fs::read(&path) {
|
||||||
Ok(bytes) => {
|
Ok(bytes) => {
|
||||||
|
let is_test_capture = already_forwarded && label.starts_with("test-");
|
||||||
let (forwarded, error) = if already_forwarded {
|
let (forwarded, error) = if already_forwarded {
|
||||||
(true, None)
|
(!is_test_capture, None)
|
||||||
} else {
|
} else {
|
||||||
forward_payload(&config, &bytes)
|
forward_payload(&config, &bytes)
|
||||||
};
|
};
|
||||||
process_payload(
|
process_payload(
|
||||||
&state,
|
&state,
|
||||||
&app,
|
&app,
|
||||||
source,
|
if is_test_capture { "cups-test" } else { source },
|
||||||
label.clone(),
|
label.clone(),
|
||||||
bytes,
|
bytes,
|
||||||
forwarded,
|
forwarded,
|
||||||
|
|||||||
@ -36,6 +36,7 @@ def safe(value):
|
|||||||
|
|
||||||
job_id = safe(sys.argv[1] if len(sys.argv) > 1 else "job")
|
job_id = safe(sys.argv[1] if len(sys.argv) > 1 else "job")
|
||||||
title = safe(sys.argv[3] if len(sys.argv) > 3 else "print")
|
title = safe(sys.argv[3] if len(sys.argv) > 3 else "print")
|
||||||
|
printer = safe(os.environ.get("PRINTER", "printer"))
|
||||||
content_type = os.environ.get("CONTENT_TYPE", "application/pdf")
|
content_type = os.environ.get("CONTENT_TYPE", "application/pdf")
|
||||||
ext = {
|
ext = {
|
||||||
"application/pdf": "pdf",
|
"application/pdf": "pdf",
|
||||||
@ -43,7 +44,8 @@ ext = {
|
|||||||
"image/png": "png",
|
"image/png": "png",
|
||||||
"image/jpeg": "jpg",
|
"image/jpeg": "jpg",
|
||||||
}.get(content_type, "dat")
|
}.get(content_type, "dat")
|
||||||
name = f"{job_id}-{title}-{uuid.uuid4().hex}.{ext}"
|
prefix = "test-" if printer.lower() == "fieldlens-test-capture" else "print-"
|
||||||
|
name = f"{prefix}{printer}-{job_id}-{title}-{uuid.uuid4().hex}.{ext}"
|
||||||
final_path = os.path.join(SPOOL, name)
|
final_path = os.path.join(SPOOL, name)
|
||||||
part_path = final_path + ".part"
|
part_path = final_path + ".part"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user