From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Philipp Hufnagl" <p.hufnagl@proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager v8 1/2] fix #4849: api: download to storage: automatically dectect and configure compression
Date: Wed, 27 Sep 2023 19:19:06 +0200 [thread overview]
Message-ID: <d3995892-a224-4562-8b74-fab1022e0100@proxmox.com> (raw)
In-Reply-To: <d0e67a78-5ddb-2aef-42fc-902c02320053@proxmox.com>
Am 27/09/2023 um 10:57 schrieb Philipp Hufnagl:
> On 9/27/23 10:33, Thomas Lamprecht wrote:
>> FYI, I have a pretty much done patch for this already here, so if
>> you did not have anything (close to) already finished, I could push
>> that out – just mentioning to avoid potential duplicate work.
>
>
> I have nothing close. Sorry for the inconvenience and thank you for
> fixing.
OK, I now applied below change for doing this in the frontend and
reverted the API change. FWIW, this is not 100% semantically the same,
as I now try to match the file-extension with the case-insensitive flag
to allow matching a, e.g., ISO.GZ too.
----8<----
diff --git a/www/manager6/window/DownloadUrlToStorage.js b/www/manager6/window/DownloadUrlToStorage.js
index 481cb2ed..335d6aa6 100644
--- a/www/manager6/window/DownloadUrlToStorage.js
+++ b/www/manager6/window/DownloadUrlToStorage.js
@@ -66,7 +66,6 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
params: {
url: queryParam.url,
'verify-certificates': queryParam['verify-certificates'],
- 'detect-compression': view.content === 'iso' ? 1 : 0,
},
waitMsgTarget: view,
failure: res => {
@@ -81,11 +80,22 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
urlField.validate();
let data = res.result.data;
+
+ let filename = data.filename || "";
+ let compression = '__default__';
+ if (view.content === 'iso') {
+ const matches = filename.match(/^(.+)\.(gz|lzo|zst)$/i);
+ if (matches) {
+ filename = matches[1];
+ compression = matches[2];
+ }
+ }
+
view.setValues({
- filename: data.filename || "",
+ filename,
+ compression,
size: (data.size && Proxmox.Utils.format_size(data.size)) || gettext("Unknown"),
mimetype: data.mimetype || gettext("Unknown"),
- compression: data.compression || '__default__',
});
},
});
next prev parent reply other threads:[~2023-09-27 17:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 13:09 [pve-devel] [PATCH manager v8 0/2] fix #4849: allow download of compressed ISOs Philipp Hufnagl
2023-09-21 13:09 ` [pve-devel] [PATCH manager v8 1/2] fix #4849: api: download to storage: automatically dectect and configure compression Philipp Hufnagl
2023-09-26 10:56 ` Thomas Lamprecht
2023-09-26 12:25 ` Philipp Hufnagl
2023-09-26 14:23 ` Thomas Lamprecht
2023-09-26 14:54 ` Philipp Hufnagl
2023-09-26 14:57 ` Thomas Lamprecht
2023-09-27 8:03 ` Philipp Hufnagl
2023-09-27 8:33 ` Thomas Lamprecht
2023-09-27 8:57 ` Philipp Hufnagl
2023-09-27 17:19 ` Thomas Lamprecht [this message]
2023-09-21 13:09 ` [pve-devel] [PATCH manager v8 2/2] fix #4849: ui: " Philipp Hufnagl
2023-09-26 10:59 ` Thomas Lamprecht
2023-09-26 12:27 ` Philipp Hufnagl
2023-09-22 14:02 ` [pve-devel] [PATCH manager v8 0/2] fix #4849: allow download of compressed ISOs Dominik Csapak
2023-09-26 7:39 ` [pve-devel] applied-series: [PATCH manager v9 " Fabian Grünbichler
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=d3995892-a224-4562-8b74-fab1022e0100@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=p.hufnagl@proxmox.com \
--cc=pve-devel@lists.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 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.