5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-01-10 09:17:37 +03:00

add the 'urlencoded' string format

This commit is contained in:
Wolfgang Bumiller 2016-03-18 11:38:24 +01:00 committed by Dietmar Maurer
parent 28a2669d9b
commit c77b4c9640

View File

@ -110,6 +110,16 @@ sub get_format {
register_format('string', sub {}); # allow format => 'string-list'
register_format('urlencoded', \&pve_verify_urlencoded);
sub pve_verify_urlencoded {
my ($text, $noerr) = @_;
if ($text !~ /^[-%a-zA-Z0-9_.!~*'()]*$/) {
return undef if $noerr;
die "invalid urlencoded string: $text\n";
}
return $text;
}
register_format('pve-configid', \&pve_verify_configid);
sub pve_verify_configid {
my ($id, $noerr) = @_;