mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-25 23:19:20 +00:00
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 d61728e289
.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
9493f69cd7
commit
aec571de43
@ -34,7 +34,6 @@ use PVE::RRD;
|
|||||||
use PVE::Report;
|
use PVE::Report;
|
||||||
use PVE::SafeSyslog;
|
use PVE::SafeSyslog;
|
||||||
use PVE::Storage;
|
use PVE::Storage;
|
||||||
use PVE::Storage::Plugin;
|
|
||||||
use PVE::Tools;
|
use PVE::Tools;
|
||||||
use PVE::pvecfg;
|
use PVE::pvecfg;
|
||||||
|
|
||||||
@ -1566,12 +1565,6 @@ __PACKAGE__->register_method({
|
|||||||
optional => 1,
|
optional => 1,
|
||||||
default => 1,
|
default => 1,
|
||||||
},
|
},
|
||||||
'detect-compression' => {
|
|
||||||
description => "If true an auto detection of used compression will be attempted",
|
|
||||||
type => 'boolean',
|
|
||||||
optional => 1,
|
|
||||||
default => 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => {
|
returns => {
|
||||||
@ -1590,11 +1583,6 @@ __PACKAGE__->register_method({
|
|||||||
type => 'string',
|
type => 'string',
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
compression => {
|
|
||||||
type => 'string',
|
|
||||||
enum => $PVE::Storage::Plugin::KNOWN_COMPRESSION_FORMATS,
|
|
||||||
optional => 1,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
code => sub {
|
code => sub {
|
||||||
@ -1617,7 +1605,6 @@ __PACKAGE__->register_method({
|
|||||||
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
|
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
my $detect_compression = $param->{'detect-compression'} // 0;
|
|
||||||
|
|
||||||
my $req = HTTP::Request->new(HEAD => $url);
|
my $req = HTTP::Request->new(HEAD => $url);
|
||||||
my $res = $ua->request($req);
|
my $res = $ua->request($req);
|
||||||
@ -1628,7 +1615,6 @@ __PACKAGE__->register_method({
|
|||||||
my $disposition = $res->header("Content-Disposition");
|
my $disposition = $res->header("Content-Disposition");
|
||||||
my $type = $res->header("Content-Type");
|
my $type = $res->header("Content-Type");
|
||||||
|
|
||||||
my $compression;
|
|
||||||
my $filename;
|
my $filename;
|
||||||
|
|
||||||
if ($disposition && ($disposition =~ m/filename="([^"]*)"/ || $disposition =~ m/filename=([^;]*)/)) {
|
if ($disposition && ($disposition =~ m/filename="([^"]*)"/ || $disposition =~ m/filename=([^;]*)/)) {
|
||||||
@ -1642,16 +1628,10 @@ __PACKAGE__->register_method({
|
|||||||
$type = $1;
|
$type = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($detect_compression && $filename =~ m!^(.+)\.(${\PVE::Storage::Plugin::COMPRESSOR_RE})$!) {
|
|
||||||
$filename = $1;
|
|
||||||
$compression = $2;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $ret = {};
|
my $ret = {};
|
||||||
$ret->{filename} = $filename if $filename;
|
$ret->{filename} = $filename if $filename;
|
||||||
$ret->{size} = $size + 0 if $size;
|
$ret->{size} = $size + 0 if $size;
|
||||||
$ret->{mimetype} = $type if $type;
|
$ret->{mimetype} = $type if $type;
|
||||||
$ret->{compression} = $compression if $compression;
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}});
|
}});
|
||||||
|
Loading…
Reference in New Issue
Block a user