all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
@ 2023-02-09 11:41 Stefan Sterz
  2023-02-09 14:16 ` Wolfgang Bumiller
  2023-03-28 12:00 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Sterz @ 2023-02-09 11:41 UTC (permalink / raw)
  To: pbs-devel

previously the upid would just be used without a file extension when
downloading a task log. this lead to rather strange filenames that
appeared unfamiliar to users as the upid is not very prevalent in the
gui. set a proper file name based on the node name, worker type and a
time stamp instead. also add the ".log" file extension to indicate
that these files contain logs.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
 src/api2/node/tasks.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs
index d386f805..b0a4f159 100644
--- a/src/api2/node/tasks.rs
+++ b/src/api2/node/tasks.rs
@@ -341,7 +341,12 @@ fn read_task_log(
                 bail!("Parameter 'download' cannot be used with other parameters");
             }
 
-            let header_disp = format!("attachment; filename={}", &upid.to_string());
+            let header_disp = format!(
+                "attachment; filename=task-{}-{}-{}.log",
+                upid.node,
+                upid.worker_type,
+                proxmox_time::epoch_to_rfc3339_utc(upid.starttime)?
+            );
             let stream = AsyncReaderStream::new(tokio::fs::File::open(path).await?);
 
             return Ok(Response::builder()
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-28 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 11:41 [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads Stefan Sterz
2023-02-09 14:16 ` Wolfgang Bumiller
2023-02-09 14:18   ` Stefan Sterz
2023-02-09 16:59     ` Thomas Lamprecht
2023-02-10  8:43       ` Wolfgang Bumiller
2023-03-28 12:00 ` [pbs-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal