BEGIN {
$ENV{GITALIST_CONFIG} = $Bin;
- use_ok 'Catalyst::Test', 'Gitalist'
+ $ENV{GITALIST_REPO_DIR} = '';
+ use_ok 'Catalyst::Test', 'Gitalist';
}
ok( request('/')->is_success, 'Request should succeed' );
-for my $p (qw/ repo1 nodescription /) {
- my $path = '/summary?p=' . $p;
+for my $p (qw/ repo1 nodescription bare.git opml /) {
+ my $path = '/' . $p;
ok( request($path)->is_success, "$path should succeed");
}
-is request('/summary?p=DoesNotExist')->code, 404,
- '/summary?p=DoesNotExist 404s';
+my $response = request('/DoesNotExist');
+is $response->code, 404, 'invalid repository 404s';
+like $response->content, qr/Page not found/, 'invalid repository handled correctly';
+
+is request('/../../../')->code, 404, 'directory traversal failed';
+is request('/..%2F..%2F../')->code, 404, 'directory traversal failed';
+
{
# URI tests for repo1
local *test = curry_test_uri('repo1');