summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore/Helper.pm
blob: b4d52e5525dba52b8372a380b990a10719069857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package App::BorgRestore::Helper;
use v5.10;
use strict;
use warnings;


sub untaint {
	my $data = shift;
	my $regex = shift;

	$data =~ m/^($regex)$/ or die "Failed to untaint: $data";
	return $1;
}

sub untaint_archive_name {
	my $archive = shift;
	return untaint($archive, qr([a-zA-Z0-9-:+]+));
}

1;

__END__