Make creating a Storage object with a short ID an error.
Add a test to check for that. Beginning of documentation for VersionTag.
This commit is contained in:
parent
e6ef875b51
commit
b02386064d
5 changed files with 83 additions and 6 deletions
|
|
@ -432,10 +432,17 @@ sub get {
|
|||
my $session = shift;
|
||||
my $id = shift;
|
||||
return undef unless $id;
|
||||
$id =~ m/^(.{2})(.{2})/;
|
||||
my $self = {_session=>$session, _id => $id, _part1 => $1, _part2 => $2, _errors => []};
|
||||
my $self;
|
||||
$self = {_session=>$session, _id => $id, _errors => []};
|
||||
bless $self, ref($class)||$class;
|
||||
$self->_makePath unless (-e $self->getPath); # create the folder in case it got deleted somehow
|
||||
if (my ($part1, $part2) = $id =~ m/^(.{2})(.{2})/) {
|
||||
$self->{_part1} = $part1;
|
||||
$self->{_part2} = $part2;
|
||||
$self->_makePath unless (-e $self->getPath); # create the folder in case it got deleted somehow
|
||||
}
|
||||
else {
|
||||
$self->_addError("Illegal ID: $id");
|
||||
}
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue