Mercurial > hg > soundsoftware-site
comparison extra/soundsoftware/SoundSoftware.pm @ 736:51c97efbe241 feature_318
Small fixes -- avoid troubles when trying to retrive root /hg URL
author | Chris Cannam |
---|---|
date | Fri, 04 Nov 2011 16:32:17 +0000 |
parents | 8653bddf26a6 |
children | 1ce6efe3db0e |
comparison
equal
deleted
inserted
replaced
735:8653bddf26a6 | 736:51c97efbe241 |
---|---|
470 } | 470 } |
471 | 471 |
472 sub get_project_identifier { | 472 sub get_project_identifier { |
473 my $dbh = shift; | 473 my $dbh = shift; |
474 my $r = shift; | 474 my $r = shift; |
475 | |
476 my $location = $r->location; | 475 my $location = $r->location; |
477 my ($repo) = $r->uri =~ m{$location/*([^/]+)}; | 476 my $repo = ($r->uri =~ m{$location/*([^/]+)}); |
478 | 477 |
479 return $repo if (!$repo); | 478 return $repo if (!$repo); |
480 | 479 |
481 $repo =~ s/[^a-zA-Z0-9\._-]//g; | 480 $repo =~ s/[^a-zA-Z0-9\._-]//g; |
482 | 481 |
483 # The original Redmine.pm returns the string just calculated as | 482 # The original Redmine.pm returns the string just calculated as |
484 # the project identifier. That won't do for us -- we may have | 483 # the project identifier. That won't do for us -- we may have |
485 # (and in fact already do have, in our test instance) projects | 484 # (and in fact already do have, in our test instance) projects |
486 # whose repository names differ from the project identifiers. | 485 # whose repository names differ from the project identifiers. |
487 | 486 |
497 my $cfg = Apache2::Module::get_config | 496 my $cfg = Apache2::Module::get_config |
498 (__PACKAGE__, $r->server, $r->per_dir_config); | 497 (__PACKAGE__, $r->server, $r->per_dir_config); |
499 | 498 |
500 my $prefix = $cfg->{SoundSoftwareRepoPrefix}; | 499 my $prefix = $cfg->{SoundSoftwareRepoPrefix}; |
501 if (!defined $prefix) { $prefix = '%/'; } | 500 if (!defined $prefix) { $prefix = '%/'; } |
502 | |
503 my $identifier = ''; | 501 my $identifier = ''; |
504 | 502 |
505 $sth->execute($prefix . $repo); | 503 $sth->execute($prefix . $repo); |
506 my $ret = 0; | 504 my $ret = 0; |
507 if (my @row = $sth->fetchrow_array) { | 505 if (my @row = $sth->fetchrow_array) { |
546 if ($name =~ m/^\s*$/) { | 544 if ($name =~ m/^\s*$/) { |
547 # nothing even in $project_id -- probably a nonexistent project. | 545 # nothing even in $project_id -- probably a nonexistent project. |
548 # use repo name instead (don't want to admit to user that project | 546 # use repo name instead (don't want to admit to user that project |
549 # doesn't exist) | 547 # doesn't exist) |
550 my $location = $r->location; | 548 my $location = $r->location; |
551 my ($repo) = $r->uri =~ m{$location/*([^/]+)}; | 549 my $repo = ($r->uri =~ m{$location/*([^/]+)}); |
552 $name = $repo; | 550 $name = $repo; |
553 } | 551 } |
554 | 552 |
555 my $realm = '"Mercurial repository for ' . "'$name'" . '"'; | 553 my $realm = '"Mercurial repository for ' . "'$name'" . '"'; |
556 | 554 |