all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] fix #4521: api/tasks: replace upid as filename for task log downloads
@ 2023-02-09 11:43 Stefan Sterz
  2023-02-09 16:19 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Sterz @ 2023-02-09 11:43 UTC (permalink / raw)
  To: pve-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>
---
 PVE/API2/Tasks.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Tasks.pm b/PVE/API2/Tasks.pm
index 9c8de324..98cecf01 100644
--- a/PVE/API2/Tasks.pm
+++ b/PVE/API2/Tasks.pm
@@ -405,13 +405,16 @@ __PACKAGE__->register_method({
 		open($fh, '<', $filename) or die "Could not open file '$filename' - $!\n";
 	    }
 
+	    my $task_time = strftime('%FT%TZ', gmtime($task->{starttime}));
+	    my $download_name = 'task-'.$task->{node}.'-'.$task->{type}.'-'.$task_time.'.log';
+
 	    return {
 		download => {
 		    fh => $fh,
 		    stream => 1,
 		    'content-encoding' => $use_compression ? 'gzip' : undef,
 		    'content-type' => "text/plain",
-		    'content-disposition' => "attachment; filename=\"".$param->{upid}."\"",
+		    'content-disposition' => "attachment; filename=\"".$download_name."\"",
 		},
 	    },
 	} else {
-- 
2.30.2





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

* [pve-devel] applied: Re: [PATCH manager] fix #4521: api/tasks: replace upid as filename for task log downloads
  2023-02-09 11:43 [pve-devel] [PATCH manager] fix #4521: api/tasks: replace upid as filename for task log downloads Stefan Sterz
@ 2023-02-09 16:19 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-02-09 16:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

On 09/02/2023 12:43, Stefan Sterz wrote:
> 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>
> ---
>  PVE/API2/Tasks.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
>

applied, thanks!




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

end of thread, other threads:[~2023-02-09 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 11:43 [pve-devel] [PATCH manager] fix #4521: api/tasks: replace upid as filename for task log downloads Stefan Sterz
2023-02-09 16:19 ` [pve-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