Fixed tree view for repos with / in name
Jose Luis Martinez [Wed, 9 Mar 2011 22:41:42 +0000 (23:41 +0100)]
The "/" in the name of the repo was not escaped. Use uri_for_action to
generate the link to the fragments URI. That implies deleting the
"around" uri_for_action in Gitalist.pm. That seems to be OK because
tests still pass. Also, didn't find any invocation to uri_for_action
with a /fragments path.

lib/Gitalist.pm
root/fragment/ref/tree.tt2

index b406826..b2a7746 100644 (file)
@@ -41,13 +41,6 @@ around uri_for => sub {
   return $uri;
 };
 
-around uri_for_action => sub {
-  my ($orig, $c) = (shift, shift);
-  my $uri = $c->$orig(@_);
-  $$uri =~ s[/fragment\b][] if defined $uri;
-  return $uri;
-};
-
 sub uri_with {
   my ($self, @args) = @_;
   my $uri = $self->request->uri_with(@args);
index 0ec6c16..e893feb 100755 (executable)
@@ -55,6 +55,5 @@
 </tbody>
 </table>
 
-[%- # We use uri_for instead of uri_for_action as we *want* a /fragment URI in this case %]
-<span id='file_commit_info-uri' class='js-data'>[% c.uri_for('/fragment/' _ Repository.name _ '/' _ Commit.sha1 _ '/file_commit_info') %]</span>
-<span id='commit-uri' class='js-data'>[% c.uri_for_action('/ref/commit', [Repository.name, 'HEAD']) %]</span>
\ No newline at end of file
+<span id='file_commit_info-uri' class='js-data'>[% c.uri_for_action('/fragment/ref/file_commit_info', [ Repository.name, Commit.sha1 ]) %]</span>
+<span id='commit-uri' class='js-data'>[% c.uri_for_action('/ref/commit', [Repository.name, 'HEAD']) %]</span>