From aec571de431ee623a6f56925cb28f8a34eef15e4 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 26 Sep 2023 13:00:12 +0200 Subject: [PATCH] Revert "api: query_url_metadata: optionally detect compression" A simple string regex match on data that the API returns anyway can be the job of a frontend/client.. Safe to do as we never released this API change in a bumped manager version and switched the UI to extract this info client-side. This reverts commit d61728e289c82c7ce35a03b5b6b3da45ae177c5c. Signed-off-by: Thomas Lamprecht --- PVE/API2/Nodes.pm | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 1e8ed09e..0843c3a3 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -34,7 +34,6 @@ use PVE::RRD; use PVE::Report; use PVE::SafeSyslog; use PVE::Storage; -use PVE::Storage::Plugin; use PVE::Tools; use PVE::pvecfg; @@ -1566,12 +1565,6 @@ __PACKAGE__->register_method({ optional => 1, default => 1, }, - 'detect-compression' => { - description => "If true an auto detection of used compression will be attempted", - type => 'boolean', - optional => 1, - default => 0, - }, }, }, returns => { @@ -1590,11 +1583,6 @@ __PACKAGE__->register_method({ type => 'string', optional => 1, }, - compression => { - type => 'string', - enum => $PVE::Storage::Plugin::KNOWN_COMPRESSION_FORMATS, - optional => 1, - }, }, }, code => sub { @@ -1617,7 +1605,6 @@ __PACKAGE__->register_method({ SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE, ); } - my $detect_compression = $param->{'detect-compression'} // 0; my $req = HTTP::Request->new(HEAD => $url); my $res = $ua->request($req); @@ -1628,7 +1615,6 @@ __PACKAGE__->register_method({ my $disposition = $res->header("Content-Disposition"); my $type = $res->header("Content-Type"); - my $compression; my $filename; if ($disposition && ($disposition =~ m/filename="([^"]*)"/ || $disposition =~ m/filename=([^;]*)/)) { @@ -1642,16 +1628,10 @@ __PACKAGE__->register_method({ $type = $1; } - if ($detect_compression && $filename =~ m!^(.+)\.(${\PVE::Storage::Plugin::COMPRESSOR_RE})$!) { - $filename = $1; - $compression = $2; - } - my $ret = {}; $ret->{filename} = $filename if $filename; $ret->{size} = $size + 0 if $size; $ret->{mimetype} = $type if $type; - $ret->{compression} = $compression if $compression; return $ret; }}); -- 2.39.2