public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Sterz <s.sterz@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
Date: Thu, 9 Feb 2023 15:18:40 +0100	[thread overview]
Message-ID: <b7261f9d-2d97-bd8b-0388-7765b4353ca1@proxmox.com> (raw)
In-Reply-To: <20230209141654.5r2dkru47uscqbzr@fwblub>

On 2/9/23 15:16, Wolfgang Bumiller wrote:
> On Thu, Feb 09, 2023 at 12:41:39PM +0100, 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>
>> ---
>>  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)?
> 
> Mostly fine, I'm not sure the timestamp format is a good idea?
> It contains colons which seem to be turned to spaces by my browser.
> Colons in http headers are a bit weird?
> Maybe we should just strip them out or replace them with underscores or
> something?
> 

yeah this has been discussed briefly here in the bugtracker [1].
underscores sound good to me.

[1]: https://bugzilla.proxmox.com/show_bug.cgi?id=4521

>> +            );
>>              let stream = AsyncReaderStream::new(tokio::fs::File::open(path).await?);
>>  
>>              return Ok(Response::builder()





  reply	other threads:[~2023-02-09 14:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 11:41 Stefan Sterz
2023-02-09 14:16 ` Wolfgang Bumiller
2023-02-09 14:18   ` Stefan Sterz [this message]
2023-02-09 16:59     ` Thomas Lamprecht
2023-02-10  8:43       ` Wolfgang Bumiller
2023-03-28 12:00 ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7261f9d-2d97-bd8b-0388-7765b4353ca1@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal