around uri_for => sub {
my ($orig, $c) = (shift, shift);
+ my $project_name = $c->stash->{'Project'} && $c->stash->{'Project'}->name;
+ my $hash = ref($_[-1]) eq 'HASH' ? pop @_ : {};
my $params = Catalyst::Utils::merge_hashes(
- { p => $c->model('Git')->project },
- ref($_[-1]) eq 'HASH' ? pop @_ : {}
+ { p => $hash->{p} || $project_name },
+ $hash,
);
+ delete $params->{p} unless defined $params->{p} && length $params->{p};
(my $uri = $c->$orig(@_, $params))
=~ tr[&][;];
return $uri;