static: fix git raw file redirect

When converting this from a htaccess file to run in the virtualhost
context, one instance of '^cgit' -> '^/cgit' was missed.  Fix it, and
add a coverage test for it to testinfra.

Change-Id: Icc1dae6dce232e69c5cd1cf98b594f562c60d3f2
This commit is contained in:
Ian Wienand 2020-02-27 09:48:58 +11:00
parent 7dc6b7c89f
commit d78f3fa8f3
2 changed files with 4 additions and 2 deletions

View File

@ -103,7 +103,7 @@ RewriteCond %{QUERY_STRING} h=([\w/]+)
RewriteRule "^/cgit/(.*?)/(.*?)/plain/?(.*)" "https://opendev.org/$1/$2/raw/branch/%1/$3" [L,QSD]
# if there's no args:
RewriteRule "^cgit/(.*?)/(.*?)/plain/?(.*)" "https://opendev.org/$1/$2/raw/branch/master/$3" [L,QSD]
RewriteRule "^/cgit/(.*?)/(.*?)/plain/?(.*)" "https://opendev.org/$1/$2/raw/branch/master/$3" [L,QSD]
######################
# commit tab (with file) -> commit screen (without file)

View File

@ -138,7 +138,9 @@ git_redirects = (
'https://opendev.org/openstack/tripleo-ansible/commit/a6f9b1551baf5f680c05f4fa69ac926f8a0a3f81'),
('git.starlingx.io/stx-tools', 'https://opendev.org/openstack/stx-tools'),
('git.zuul-ci.org/zuul', 'https://opendev.org/openstack-infra/zuul'),
('git.airshipit.org/airship-in-a-bottle', 'https://opendev.org/openstack/airship-in-a-bottle')
('git.airshipit.org/airship-in-a-bottle', 'https://opendev.org/openstack/airship-in-a-bottle'),
('git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt',
'https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt')
)
@pytest.mark.parametrize("url,target", git_redirects)