repo-id-auth.patch

Ciprian Ciubotariu, 2013-07-23 17:04

Download (949 Bytes)

View differences:

extra/svn/Redmine.pm
531 531
    my $location = $r->location;
532 532
    $location =~ s/\.git$// if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp});
533 533
    my ($identifier) = $r->uri =~ m{$location/*([^/.]+)};
534

  
535
    my $dbh = connect_database($r);
536
    my $sth = $dbh->prepare("SELECT id FROM projects WHERE identifier = ?;");
537
    $sth->execute($identifier);
538
    if (!$sth->fetchrow_array) {
539
        $sth = $dbh->prepare("SELECT p.identifier FROM projects p, repositories r WHERE p.id = r.project_id AND r.identifier = ?;");
540
        $sth->execute($identifier);
541
        if (my @row = $sth->fetchrow_array) {
542
            $identifier = $row[0];
543
        }
544
    }
545
    $sth->finish();
546
    undef $sth;
547
    $dbh->disconnect();
548
    undef $dbh;
549

  
534 550
    $identifier;
535 551
}
536 552