more strictly parse login and path
[cloudstore.git] / gearman / send_file.pl
index c828de8..1c093d1 100755 (executable)
@@ -25,8 +25,8 @@ $worker->register_function( send_file => sub {
 
        my ( $from, $to ) = split(/#/,$work,2);
        
-       my $f_uid = $1 if $from =~ s/~(\w+)//;
-       my $t_uid = $1 if $to   =~ s/~(\w+)//;
+       my $f_uid = $1 if $from =~ s{~(\w+)/}{};
+       my $t_uid = $1 if $to   =~ s{~(\w+)/}{};
 
        warn "send_file $f_uid $from -> $t_uid $to\n";
 
@@ -41,7 +41,7 @@ $worker->register_function( rename_file => sub {
        warn "# rename_file [$work]\n";
 
        my ( $from, $to ) = split(/#/,$work,2);
-       my $login = $1 if $from =~ s/~(\w+)//;
+       my $login = $1 if $from =~ s{~(\w+)/}{};
        $api->rename_file( $login, $from, $to );
 });
 
@@ -51,7 +51,7 @@ $worker->register_function( delete => sub {
        chomp $work;
        warn "# delete [$work]\n";
 
-       my $login = $1 if $work =~ s/~(\w+)//;
+       my $login = $1 if $work =~ s{~(\w+)}{};
        $api->delete( $login, $work );
 
 });