* [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
* Re: [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
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-03-28 12:00 ` [pbs-devel] applied: " Thomas Lamprecht
1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Bumiller @ 2023-02-09 14:16 UTC (permalink / raw)
To: Stefan Sterz; +Cc: pbs-devel
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?
> + );
> let stream = AsyncReaderStream::new(tokio::fs::File::open(path).await?);
>
> return Ok(Response::builder()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
2023-02-09 14:16 ` Wolfgang Bumiller
@ 2023-02-09 14:18 ` Stefan Sterz
2023-02-09 16:59 ` Thomas Lamprecht
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Sterz @ 2023-02-09 14:18 UTC (permalink / raw)
To: Wolfgang Bumiller; +Cc: pbs-devel
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()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
2023-02-09 14:18 ` Stefan Sterz
@ 2023-02-09 16:59 ` Thomas Lamprecht
2023-02-10 8:43 ` Wolfgang Bumiller
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Lamprecht @ 2023-02-09 16:59 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Stefan Sterz,
Wolfgang Bumiller
On 09/02/2023 15:18, Stefan Sterz wrote:
>> It contains colons which seem to be turned to spaces by my browser.
>> Colons in http headers are a bit weird?
Colons are fine in HTTP header, they don't add any ambiguity on it's own as header
key's are the part from start of line to the _first_ colon.
The RFCs (7231 or the updated 9110) allow all printable ASCII chars (0x21 to 0x7E).
In fact, if I use `curl -OJ`, telling it to use the content-disposition header, it
does the right thing and safes the file correctly, preserving colons.
FWICT it's really just due to Windows limitations w.r.t. file naming that the
browser seemingly spread to all platforms (possibly to avoid that Linux user
passing files to Windows users breaks) - maybe open a bug there? x)
>> Maybe we should just strip them out or replace them with underscores or
>> something?
> underscores sound good to me.
>
meh... if, we'd need to adapt PVE again, there I already applied this.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pbs-devel] [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
2023-02-09 16:59 ` Thomas Lamprecht
@ 2023-02-10 8:43 ` Wolfgang Bumiller
0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Bumiller @ 2023-02-10 8:43 UTC (permalink / raw)
To: Thomas Lamprecht
Cc: Proxmox Backup Server development discussion, Stefan Sterz
On Thu, Feb 09, 2023 at 05:59:44PM +0100, Thomas Lamprecht wrote:
> On 09/02/2023 15:18, Stefan Sterz wrote:
> >> It contains colons which seem to be turned to spaces by my browser.
> >> Colons in http headers are a bit weird?
>
> Colons are fine in HTTP header, they don't add any ambiguity on it's own as header
> key's are the part from start of line to the _first_ colon.
> The RFCs (7231 or the updated 9110) allow all printable ASCII chars (0x21 to 0x7E).
>
> In fact, if I use `curl -OJ`, telling it to use the content-disposition header, it
> does the right thing and safes the file correctly, preserving colons.
>
> FWICT it's really just due to Windows limitations w.r.t. file naming that the
> browser seemingly spread to all platforms (possibly to avoid that Linux user
> passing files to Windows users breaks) - maybe open a bug there? x)
So what do browsers do with a C source file named 'con.c'? ;-)
(You definitely can't clone a git repo containing such a file on a
certain platform... ;-) )
>
> >> Maybe we should just strip them out or replace them with underscores or
> >> something?
>
> > underscores sound good to me.
> >
> meh... if, we'd need to adapt PVE again, there I already applied this.
I mean, I just found it weird. We have the 'T' for some reason and then
the browser uses spaces for colons, it's ugly. But I also don't really
actually care as long as it works...
(And to be fair, to me, underscores wouldn't even be a *solution*, but
rather a hack because I don't trust browsers...)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pbs-devel] applied: [PATCH proxmox-backup] fix #4521: api/tasks: replace upid as filename for task log downloads
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-03-28 12:00 ` Thomas Lamprecht
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-03-28 12:00 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Stefan Sterz
Am 09/02/2023 um 12:41 schrieb Stefan Sterz:
> 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(-)
>
>
applied, thanks!
^ 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox