Fix Copy/Move to Default Storage

When moving from a 2nd storage to Default it fails with "New storage does not have an id.  Moving will not happen" because the default ID is 0.
This commit is contained in:
maddios 2021-11-29 00:20:25 -05:00 committed by GitHub
parent 6aaebafd17
commit b47e96d7cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -43,6 +43,7 @@ require Date::Parse;
require POSIX; require POSIX;
use Date::Format qw(time2str); use Date::Format qw(time2str);
use Time::HiRes qw(gettimeofday tv_interval stat); use Time::HiRes qw(gettimeofday tv_interval stat);
use Scalar::Util qw(looks_like_number);
#our @ISA = qw(ZoneMinder::Object); #our @ISA = qw(ZoneMinder::Object);
use parent qw(ZoneMinder::Object); use parent qw(ZoneMinder::Object);
@ -601,7 +602,7 @@ sub CopyTo {
# First determine if we can move it to the dest. # First determine if we can move it to the dest.
# We do this before bothering to lock the event # We do this before bothering to lock the event
my ( $NewPath ) = ( $NewStorage->Path() =~ /^(.*)$/ ); # De-taint my ( $NewPath ) = ( $NewStorage->Path() =~ /^(.*)$/ ); # De-taint
if ( ! $$NewStorage{Id} ) { if ( ! looks_like_number($$NewStorage{Id}) ) {
return 'New storage does not have an id. Moving will not happen.'; return 'New storage does not have an id. Moving will not happen.';
} elsif ( $$NewStorage{Id} == $$self{StorageId} ) { } elsif ( $$NewStorage{Id} == $$self{StorageId} ) {
return 'Event is already located at ' . $NewPath; return 'Event is already located at ' . $NewPath;