mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 15:58:20 +00:00
fix #4521: api/tasks: replace upid as filename for task log downloads
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>
This commit is contained in:
parent
a219043af6
commit
31746f261a
@ -405,13 +405,16 @@ __PACKAGE__->register_method({
|
|||||||
open($fh, '<', $filename) or die "Could not open file '$filename' - $!\n";
|
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 {
|
return {
|
||||||
download => {
|
download => {
|
||||||
fh => $fh,
|
fh => $fh,
|
||||||
stream => 1,
|
stream => 1,
|
||||||
'content-encoding' => $use_compression ? 'gzip' : undef,
|
'content-encoding' => $use_compression ? 'gzip' : undef,
|
||||||
'content-type' => "text/plain",
|
'content-type' => "text/plain",
|
||||||
'content-disposition' => "attachment; filename=\"".$param->{upid}."\"",
|
'content-disposition' => "attachment; filename=\"".$download_name."\"",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user